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.
- #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 |
# 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.response :json conn.adapter :net_http end end |
Instance Method Details
#with_rescue ⇒ Object
18 19 20 21 22 |
# File 'lib/platform_sdk/identity/clients.rb', line 18 def with_rescue yield rescue ResourceNotFound => e puts e end |