Class: StandardId::HttpClient

Inherits:
Object
  • Object
show all
Defined in:
lib/standard_id/http_client.rb

Class Method Summary collapse

Class Method Details

.get_with_bearer(endpoint, access_token) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/standard_id/http_client.rb', line 12

def get_with_bearer(endpoint, access_token)
  uri = URI(endpoint)
  request = Net::HTTP::Get.new(uri)
  request["Authorization"] = "Bearer #{access_token}"
  Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
    http.request(request)
  end
end

.post_form(endpoint, params) ⇒ Object



7
8
9
10
# File 'lib/standard_id/http_client.rb', line 7

def post_form(endpoint, params)
  uri = URI(endpoint)
  Net::HTTP.post_form(uri, params)
end