Class: Afterpay::Discount
- Inherits:
-
Object
- Object
- Afterpay::Discount
- Defined in:
- lib/afterpay/discount.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, amount:) ⇒ Discount
constructor
A new instance of Discount.
- #to_hash ⇒ Object
Constructor Details
#initialize(name:, amount:) ⇒ Discount
Returns a new instance of Discount.
7 8 9 10 |
# File 'lib/afterpay/discount.rb', line 7 def initialize(name:, amount:) @name = name @amount = amount end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
5 6 7 |
# File 'lib/afterpay/discount.rb', line 5 def amount @amount end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/afterpay/discount.rb', line 5 def name @name end |
Class Method Details
.from_response(response) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/afterpay/discount.rb', line 19 def self.from_response(response) return nil if response.nil? new( name: response[:display_name], amount: Utils::Money.from_response(response[:amount]) ) end |