Class: Tappay::Configuration
- Inherits:
-
Object
- Object
- Tappay::Configuration
- Defined in:
- lib/tappay/configuration.rb
Instance Attribute Summary collapse
- #api_version ⇒ Object
-
#apple_pay_merchant_id ⇒ Object
Returns the value of attribute apple_pay_merchant_id.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#google_pay_merchant_id ⇒ Object
Returns the value of attribute google_pay_merchant_id.
-
#instalment_merchant_id ⇒ Object
Returns the value of attribute instalment_merchant_id.
-
#ipass_money_merchant_id ⇒ Object
Returns the value of attribute ipass_money_merchant_id.
-
#jko_pay_merchant_id ⇒ Object
Returns the value of attribute jko_pay_merchant_id.
-
#line_pay_merchant_id ⇒ Object
Returns the value of attribute line_pay_merchant_id.
-
#merchant_group_id ⇒ Object
Returns the value of attribute merchant_group_id.
-
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
-
#partner_key ⇒ Object
Returns the value of attribute partner_key.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #mode ⇒ Object
- #mode=(value) ⇒ Object
- #production? ⇒ Boolean
- #sandbox? ⇒ Boolean
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 |
# File 'lib/tappay/configuration.rb', line 11 def initialize @mode = :sandbox @api_version = '3' end |
Instance Attribute Details
#api_version ⇒ Object
16 17 18 |
# File 'lib/tappay/configuration.rb', line 16 def api_version @api_version.to_s end |
#apple_pay_merchant_id ⇒ Object
Returns the value of attribute apple_pay_merchant_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def apple_pay_merchant_id @apple_pay_merchant_id end |
#currency ⇒ Object
Returns the value of attribute currency.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def currency @currency end |
#google_pay_merchant_id ⇒ Object
Returns the value of attribute google_pay_merchant_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def google_pay_merchant_id @google_pay_merchant_id end |
#instalment_merchant_id ⇒ Object
Returns the value of attribute instalment_merchant_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def instalment_merchant_id @instalment_merchant_id end |
#ipass_money_merchant_id ⇒ Object
Returns the value of attribute ipass_money_merchant_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def ipass_money_merchant_id @ipass_money_merchant_id end |
#jko_pay_merchant_id ⇒ Object
Returns the value of attribute jko_pay_merchant_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def jko_pay_merchant_id @jko_pay_merchant_id end |
#line_pay_merchant_id ⇒ Object
Returns the value of attribute line_pay_merchant_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def line_pay_merchant_id @line_pay_merchant_id end |
#merchant_group_id ⇒ Object
Returns the value of attribute merchant_group_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def merchant_group_id @merchant_group_id end |
#merchant_id ⇒ Object
Returns the value of attribute merchant_id.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def merchant_id @merchant_id end |
#partner_key ⇒ Object
Returns the value of attribute partner_key.
5 6 7 |
# File 'lib/tappay/configuration.rb', line 5 def partner_key @partner_key end |
Instance Method Details
#mode ⇒ Object
35 36 37 |
# File 'lib/tappay/configuration.rb', line 35 def mode @mode ||= :sandbox end |
#mode=(value) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/tappay/configuration.rb', line 28 def mode=(value) unless [:sandbox, :production].include?(value.to_sym) raise ArgumentError, "Invalid mode. Must be :sandbox or :production" end @mode = value.to_sym end |
#production? ⇒ Boolean
24 25 26 |
# File 'lib/tappay/configuration.rb', line 24 def production? @mode == :production end |
#sandbox? ⇒ Boolean
20 21 22 |
# File 'lib/tappay/configuration.rb', line 20 def sandbox? @mode == :sandbox end |
#validate! ⇒ Object
39 40 41 42 |
# File 'lib/tappay/configuration.rb', line 39 def validate! raise ValidationError, 'partner_key is required' if partner_key.nil? raise ValidationError, 'Either merchant_id or merchant_group_id is required' if merchant_id.nil? && merchant_group_id.nil? end |