Class: Passage::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/passageidentity/client.rb

Overview

The Passage::Client class provides methods for interacting with Passage

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_id:, api_key:) ⇒ Client

Returns a new instance of Client.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/passageidentity/client.rb', line 12

def initialize(app_id:, api_key:)
  unless app_id && !app_id.empty?
    raise ArgumentError,
          'A Passage App ID is required. Please include (app_id: YOUR_APP_ID, api_key: YOUR_API_KEY).'
  end
  unless api_key && !api_key.empty?
    raise ArgumentError,
          'A Passage API key is required. Please include (app_id: YOUR_APP_ID, api_key: YOUR_API_KEY).'
  end

  req_opts = {}
  req_opts[:header_params] = {
    'Passage-Version' => "passage-ruby #{Passage::VERSION}",
    'Authorization' => "Bearer #{api_key}"
  }
  req_opts[:debug_auth_names] = ['header']

  @auth = Passage::Auth.new(app_id: app_id, req_opts: req_opts)
  @user = Passage::User.new(app_id: app_id, req_opts: req_opts)
end

Instance Attribute Details

#authObject (readonly)

Returns the value of attribute auth.



10
11
12
# File 'lib/passageidentity/client.rb', line 10

def auth
  @auth
end

#userObject (readonly)

Returns the value of attribute user.



10
11
12
# File 'lib/passageidentity/client.rb', line 10

def user
  @user
end