Skip to content

Instantly share code, notes, and snippets.

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