Class: Revolut::Client

Inherits:
Object
  • Object
show all
Includes:
HTTP
Defined in:
lib/revolut/client.rb

Constant Summary collapse

CONFIG_KEYS =
%i[
  client_id
  signing_key
  iss
  token_duration
  scope
  authorize_redirect_uri
  api_version
  environment
  request_timeout
  global_headers
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HTTP

#delete, #get, #get_access_token, #patch, #post, #refresh_access_token

Constructor Details

#initialize(**attrs) ⇒ Client

Returns a new instance of Client.



20
21
22
23
24
25
26
27
28
# File 'lib/revolut/client.rb', line 20

def initialize(**attrs)
  CONFIG_KEYS.each do |key|
    # Set instance variables like api_type & access_token. Fall back to global config
    # if not present.
    instance_variable_set(:"@#{key}", attrs[key] || Revolut.config.send(key))
  end

  @base_uri = (environment == :sandbox) ? "https://sandbox-b2b.revolut.com/api/#{api_version}/" : "https://b2b.revolut.com/api/#{api_version}/"
end

Class Method Details

.instanceObject

Instance with all the defaults



31
32
33
# File 'lib/revolut/client.rb', line 31

def self.instance
  @instance ||= new
end