Class: PlatformSdk::Identity::Client
- Inherits:
-
Object
- Object
- PlatformSdk::Identity::Client
- Defined in:
- lib/platform_sdk/identity/clients.rb
Overview
Client for making calls to the Identity Server API
Instance Method Summary collapse
-
#initialize(identity_base_url, client_id, client_secret, auth_client = nil) ⇒ Client
constructor
A new instance of Client.
- #provision_identity(user_params) ⇒ Object
- #with_rescue ⇒ Object
Constructor Details
#initialize(identity_base_url, client_id, client_secret, auth_client = nil) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/platform_sdk/identity/clients.rb', line 7 def initialize(identity_base_url, client_id, client_secret, auth_client = nil) @auth = auth_client.nil? ? AuthClient.new(identity_base_url, client_id, client_secret) : auth_client @conn = Faraday.new(identity_base_url) do |conn| conn.request :authorization, 'Bearer', -> { @auth.auth_token } conn.request :retry conn.request :json conn.response :json conn.adapter :net_http end end |
Instance Method Details
#provision_identity(user_params) ⇒ Object
19 20 21 22 |
# File 'lib/platform_sdk/identity/clients.rb', line 19 def provision_identity(user_params) response = @conn.post('/api/accounts/WithProfile', user_params) response.body end |
#with_rescue ⇒ Object
24 25 26 27 28 |
# File 'lib/platform_sdk/identity/clients.rb', line 24 def with_rescue yield rescue ResourceNotFound => e puts e end |