Class: Audiences::Scim::Client
- Inherits:
-
Object
- Object
- Audiences::Scim::Client
- Defined in:
- lib/audiences/scim/client.rb
Instance Method Summary collapse
-
#initialize(uri:, headers: {}) ⇒ Client
constructor
A new instance of Client.
- #perform_request(method:, path:, query: {}) ⇒ Object
Constructor Details
#initialize(uri:, headers: {}) ⇒ Client
Returns a new instance of Client.
10 11 12 13 |
# File 'lib/audiences/scim/client.rb', line 10 def initialize(uri:, headers: {}) @uri = uri @headers = headers end |
Instance Method Details
#perform_request(method:, path:, query: {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/audiences/scim/client.rb', line 15 def perform_request(method:, path:, query: {}) uri = URI.join(@uri, path.to_s) uri.query = URI.encode_www_form(query) request = ::Net::HTTP.const_get(method).new(uri, @headers) http = ::Net::HTTP.new(uri.host, uri.port) http.use_ssl = uri.scheme == "https" response = http.request(request) JSON.parse(response.body) end |