Class: Payoneer::Configuration::Config
- Inherits:
-
Object
- Object
- Payoneer::Configuration::Config
- 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
-
#env ⇒ Object
Returns the value of attribute env.
-
#partner_api_password ⇒ Object
Returns the value of attribute partner_api_password.
-
#partner_id ⇒ Object
Returns the value of attribute partner_id.
-
#partner_username ⇒ Object
Returns the value of attribute partner_username.
-
#program_id ⇒ Object
Returns the value of attribute program_id.
Instance Method Summary collapse
- #api_url ⇒ Object
-
#initialize(options) ⇒ Config
constructor
A new instance of Config.
- #production? ⇒ Boolean
- #validate! ⇒ Object
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() .each do |key, value| send("#{key}=", value) end end |
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env.
25 26 27 |
# File 'lib/payoneer/configuration.rb', line 25 def env @env end |
#partner_api_password ⇒ Object
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_id ⇒ Object
Returns the value of attribute partner_id.
25 26 27 |
# File 'lib/payoneer/configuration.rb', line 25 def partner_id @partner_id end |
#partner_username ⇒ Object
Returns the value of attribute partner_username.
25 26 27 |
# File 'lib/payoneer/configuration.rb', line 25 def partner_username @partner_username end |
#program_id ⇒ Object
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_url ⇒ Object
41 42 43 |
# File 'lib/payoneer/configuration.rb', line 41 def api_url production? ? PRODUCTION_API_URL : SANDBOX_API_URL end |
#production? ⇒ Boolean
37 38 39 |
# File 'lib/payoneer/configuration.rb', line 37 def production? self.env == 'production' end |
#validate! ⇒ Object
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 |