Class: Tappay::Configuration
- Inherits:
-
Object
- Object
- Tappay::Configuration
- Defined in:
- lib/tappay/configuration.rb
Instance Attribute Summary collapse
-
#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.
10 11 12 |
# File 'lib/tappay/configuration.rb', line 10 def initialize @mode = :sandbox end |
Instance Attribute Details
#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
29 30 31 |
# File 'lib/tappay/configuration.rb', line 29 def mode @mode ||= :sandbox end |
#mode=(value) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/tappay/configuration.rb', line 22 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
18 19 20 |
# File 'lib/tappay/configuration.rb', line 18 def production? @mode == :production end |
#sandbox? ⇒ Boolean
14 15 16 |
# File 'lib/tappay/configuration.rb', line 14 def sandbox? @mode == :sandbox end |
#validate! ⇒ Object
33 34 35 36 |
# File 'lib/tappay/configuration.rb', line 33 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 |