Class: Payoneer::Configuration::Config

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

Constant Summary collapse

SANDBOX_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

#initialize(options) ⇒ Config

Returns a new instance of Config.



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

def initialize(options)
  options.each do |key, value|
    send("#{key}=", value)
  end
end

Instance Attribute Details

#envObject

Returns the value of attribute env.



25
26
27
# File 'lib/payoneer/configuration.rb', line 25

def env
  @env
end

#partner_api_passwordObject

Returns the value of attribute partner_api_password.



25
26
27
# File 'lib/payoneer/configuration.rb', line 25

def partner_api_password
  @partner_api_password
end

#partner_idObject

Returns the value of attribute partner_id.



25
26
27
# File 'lib/payoneer/configuration.rb', line 25

def partner_id
  @partner_id
end

#partner_usernameObject

Returns the value of attribute partner_username.



25
26
27
# File 'lib/payoneer/configuration.rb', line 25

def partner_username
  @partner_username
end

#program_idObject

Returns the value of attribute program_id.



25
26
27
# File 'lib/payoneer/configuration.rb', line 25

def program_id
  @program_id
end

Instance Method Details

#api_urlObject



41
42
43
# File 'lib/payoneer/configuration.rb', line 41

def api_url
  production? ? PRODUCTION_API_URL : SANDBOX_API_URL
end

#production?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/payoneer/configuration.rb', line 37

def production?
  self.env == 'production'
end

#validate!Object

Raises:

  • (ConfigurationError)


33
34
35
# File 'lib/payoneer/configuration.rb', line 33

def validate!
  raise ConfigurationError.new unless %w(partner_username partner_api_password partner_id program_id env).all?{|k| self.send(k).present? }
end