Class: Tipalti::Client

Inherits:
Object
  • Object
show all
Includes:
Actions::Payee, Actions::Payment, Actions::PaymentBatch, Actions::Token
Defined in:
lib/tipalti-ruby/client.rb

Constant Summary collapse

BASE_URL_P =
"https://api-p.tipalti.com"
BASE_URL_S =
"https://api-sb.tipalti.com"
TOKEN_URL_P =
"https://sso.tipalti.com"
TOKEN_URL_S =
"https://sso.sandbox.tipalti.com"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Actions::Token

#token_refresh

Methods included from Actions::PaymentBatch

#payment_batch_create, #payment_batch_instructions_get

Methods included from Actions::Payment

#payment_get

Methods included from Actions::Payee

#payee_create, #payee_get, #payee_list

Constructor Details

#initialize(client_id:, client_secret:, access_token:, refresh_token: nil, code_verifier: nil, sandbox: false) ⇒ Client

rubocop:disable Metrics/ParameterLists



17
18
19
20
21
22
23
24
# File 'lib/tipalti-ruby/client.rb', line 17

def initialize(client_id:, client_secret:, access_token:, refresh_token: nil, code_verifier: nil, sandbox: false) # rubocop:disable Metrics/ParameterLists
  @client_id      = client_id
  @client_secret  = client_secret
  @access_token   = access_token
  @refresh_token  = refresh_token
  @code_verifier  = code_verifier
  @sandbox        = sandbox
end

Instance Attribute Details

#sandboxObject

Returns the value of attribute sandbox.



15
16
17
# File 'lib/tipalti-ruby/client.rb', line 15

def sandbox
  @sandbox
end

Instance Method Details

#base_urlObject



26
27
28
# File 'lib/tipalti-ruby/client.rb', line 26

def base_url
  @sandbox ? BASE_URL_S : BASE_URL_P
end

#connectionObject



30
31
32
# File 'lib/tipalti-ruby/client.rb', line 30

def connection
  Connection.new(access_token: @access_token, url: base_url)
end

#connection_tokenObject



34
35
36
# File 'lib/tipalti-ruby/client.rb', line 34

def connection_token
  Connection.new(url: token_url)
end

#token_urlObject



38
39
40
# File 'lib/tipalti-ruby/client.rb', line 38

def token_url
  @sandbox ? TOKEN_URL_S : TOKEN_URL_P
end