Class: Payoneer::Configuration

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

Constant Summary collapse

DEVELOPMENT_ENVIRONMENT =
'development'
PRODUCTION_ENVIRONMENT =
'production'
DEVELOPMENT_API_URL =
'https://api.sandbox.payoneer.com/Payouts/HttpApi/API.aspx?'
PRODUCTION_API_URL =
'https://api.payoneer.com/Payouts/HttpApi/API.aspx?'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



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

def initialize
  @environment = DEVELOPMENT_ENVIRONMENT
  @auto_approve_sandbox_accounts = false
end

Instance Attribute Details

#auto_approve_sandbox_accountsObject

Returns the value of attribute auto_approve_sandbox_accounts.



8
9
10
# File 'lib/payoneer/configuration.rb', line 8

def auto_approve_sandbox_accounts
  @auto_approve_sandbox_accounts
end

#environmentObject

Returns the value of attribute environment.



8
9
10
# File 'lib/payoneer/configuration.rb', line 8

def environment
  @environment
end

#partner_api_passwordObject

Returns the value of attribute partner_api_password.



8
9
10
# File 'lib/payoneer/configuration.rb', line 8

def partner_api_password
  @partner_api_password
end

#partner_idObject

Returns the value of attribute partner_id.



8
9
10
# File 'lib/payoneer/configuration.rb', line 8

def partner_id
  @partner_id
end

#partner_usernameObject

Returns the value of attribute partner_username.



8
9
10
# File 'lib/payoneer/configuration.rb', line 8

def partner_username
  @partner_username
end

Instance Method Details

#api_urlObject



19
20
21
# File 'lib/payoneer/configuration.rb', line 19

def api_url
  production? ? PRODUCTION_API_URL : DEVELOPMENT_API_URL
end

#auto_approve_sandbox_accounts?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/payoneer/configuration.rb', line 23

def auto_approve_sandbox_accounts?
  !production? && auto_approve_sandbox_accounts
end

#production?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/payoneer/configuration.rb', line 15

def production?
  environment == PRODUCTION_ENVIRONMENT
end

#validate!Object



27
28
29
# File 'lib/payoneer/configuration.rb', line 27

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