Class: PayoneerApiClient::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/payoneer_api_client/configuration.rb

Constant Summary collapse

DEVELOPMENT_ENVIRONMENT =
'development'
PRODUCTION_ENVIRONMENT =
'production'
DEVELOPMENT_API_URL =
'https://api.sandbox.payoneer.com/v2/programs'
PRODUCTION_API_URL =
'https://api.payoneer.com/v2/programs'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
# File 'lib/payoneer_api_client/configuration.rb', line 12

def initialize
  @environment = DEVELOPMENT_ENVIRONMENT
end

Instance Attribute Details

#environmentObject

Returns the value of attribute environment.



10
11
12
# File 'lib/payoneer_api_client/configuration.rb', line 10

def environment
  @environment
end

#partner_api_passwordObject

Returns the value of attribute partner_api_password.



10
11
12
# File 'lib/payoneer_api_client/configuration.rb', line 10

def partner_api_password
  @partner_api_password
end

#partner_idObject

Returns the value of attribute partner_id.



10
11
12
# File 'lib/payoneer_api_client/configuration.rb', line 10

def partner_id
  @partner_id
end

#partner_usernameObject

Returns the value of attribute partner_username.



10
11
12
# File 'lib/payoneer_api_client/configuration.rb', line 10

def partner_username
  @partner_username
end

Instance Method Details

#api_urlObject



20
21
22
# File 'lib/payoneer_api_client/configuration.rb', line 20

def api_url
  create_url(production? ? PRODUCTION_API_URL : DEVELOPMENT_API_URL)
end

#create_url(url) ⇒ Object



24
25
26
# File 'lib/payoneer_api_client/configuration.rb', line 24

def create_url(url)
  "#{url}/#{partner_id}"
end

#production?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/payoneer_api_client/configuration.rb', line 16

def production?
  environment == PRODUCTION_ENVIRONMENT
end

#validate!Object



28
29
30
# File 'lib/payoneer_api_client/configuration.rb', line 28

def validate!
  raise Errors::ConfigurationError unless partner_id && partner_username && partner_api_password
end