Class: AituWallet::Client
- Inherits:
-
Object
- Object
- AituWallet::Client
- Defined in:
- lib/aitu_wallet/client.rb
Overview
Client to send Aitu Wallet requests
Instance Attribute Summary collapse
-
#auth_token ⇒ Object
Returns the value of attribute auth_token.
-
#handler ⇒ Object
readonly
Returns the value of attribute handler.
Instance Method Summary collapse
-
#build_passport_link(phone, back_url, scope = 'idpc_verification') ⇒ Hash, NilClass
Builds link to crete Aitu Passport account.
-
#get_user_info(phone) ⇒ Hash, NilClass
Gets info about user's account.
-
#initialize(login, password) ⇒ Client
constructor
Creates connection to Aitu Wallet endpoints and sets basic auth headers.
Constructor Details
#initialize(login, password) ⇒ Client
Creates connection to Aitu Wallet endpoints and sets basic auth headers
29 30 31 32 33 |
# File 'lib/aitu_wallet/client.rb', line 29 def initialize(login, password) @handler = Faraday.new(BASE_URL) do |connection| connection.request :authorization, :basic, login, password end end |
Instance Attribute Details
#auth_token ⇒ Object
Returns the value of attribute auth_token.
23 24 25 |
# File 'lib/aitu_wallet/client.rb', line 23 def auth_token @auth_token end |
#handler ⇒ Object (readonly)
Returns the value of attribute handler.
22 23 24 |
# File 'lib/aitu_wallet/client.rb', line 22 def handler @handler end |
Instance Method Details
#build_passport_link(phone, back_url, scope = 'idpc_verification') ⇒ Hash, NilClass
Builds link to crete Aitu Passport account
48 49 50 51 52 53 |
# File 'lib/aitu_wallet/client.rb', line 48 def build_passport_link(phone, back_url, scope = 'idpc_verification') post_request( ENDPOINTS[:passport], get_link_request_data(phone, back_url, scope) ) end |
#get_user_info(phone) ⇒ Hash, NilClass
Gets info about user's account
39 40 41 |
# File 'lib/aitu_wallet/client.rb', line 39 def get_user_info(phone) get_request(ENDPOINTS[:user] + "/#{phone}") end |