Last active
July 11, 2018 17:34
-
-
Save chelseatroy/fc84c6977357ea6b29c31016e50f9fda to your computer and use it in GitHub Desktop.
Combining Protocol Conventions - Request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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