Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Last active July 11, 2018 17:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Combining Protocol Conventions - Request
require 'uri'
require 'net/http'
class MemberService
def get_members(filters=Hash.new)
query_params = filters.to_query
uri = URI("https://bertrandshealthinsurance.com/members?#{query_params}")
request = Net::HTTP::Get.new(uri.path, {'Content-Type' => 'application/json'})
request.body = json_options: {
only: [:name, :date_of_birth],
include: {
dependents: {
only: [:name, :date_of_birth]
}
}
}.to_json
response = http.request(request)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment