Class: AituWallet::Client

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

Overview

Client to send Aitu Wallet requests

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(login, password) ⇒ Client

Creates connection to Aitu Wallet endpoints and sets basic auth headers

Parameters:

  • login (String)
  • password (String)


29
30
31
32
33
# File 'lib/aitu_wallet/client.rb', line 29

def initialize(, password)
  @handler = Faraday.new(BASE_URL) do |connection|
    connection.request :authorization, :basic, , password
  end
end

Instance Attribute Details

#auth_tokenObject

Returns the value of attribute auth_token.



23
24
25
# File 'lib/aitu_wallet/client.rb', line 23

def auth_token
  @auth_token
end

#handlerObject (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

Builds link to crete Aitu Passport account

Parameters:

  • phone (String)
  • back_url (String)

Returns:

  • (Hash, NilClass)


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

Parameters:

  • phone (String)

Returns:

  • (Hash, NilClass)


39
40
41
# File 'lib/aitu_wallet/client.rb', line 39

def (phone)
  get_request(ENDPOINTS[:user] + "/#{phone}")
end