Class: DPay::PayoutPosition
- Inherits:
-
Object
- Object
- DPay::PayoutPosition
- Defined in:
- lib/dpay/payment/payout_position.rb,
sig/dpay/payment/payout_position.rbs
Instance Attribute Summary collapse
-
#amount ⇒ Money
readonly
Returns the value of attribute amount.
-
#iban ⇒ String
readonly
Returns the value of attribute iban.
-
#title ⇒ String
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(iban, title, amount) ⇒ PayoutPosition
constructor
A new instance of PayoutPosition.
- #to_h ⇒ Hash[String, untyped]
Constructor Details
#initialize(iban, title, amount) ⇒ PayoutPosition
Returns a new instance of PayoutPosition.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/dpay/payment/payout_position.rb', line 7 def initialize(iban, title, amount) raise InvalidArgumentError, "Payout IBAN must not be empty" unless iban.is_a?(String) && !iban.empty? unless title.is_a?(String) && !title.empty? && title.length <= 255 raise InvalidArgumentError, "Payout title must be 1-255 characters" end @iban = iban @title = title @amount = amount freeze end |
Instance Attribute Details
#amount ⇒ Money (readonly)
Returns the value of attribute amount.
5 6 7 |
# File 'lib/dpay/payment/payout_position.rb', line 5 def amount @amount end |
#iban ⇒ String (readonly)
Returns the value of attribute iban.
5 6 7 |
# File 'lib/dpay/payment/payout_position.rb', line 5 def iban @iban end |
#title ⇒ String (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/dpay/payment/payout_position.rb', line 5 def title @title end |
Instance Method Details
#to_h ⇒ Hash[String, untyped]
19 20 21 |
# File 'lib/dpay/payment/payout_position.rb', line 19 def to_h { "iban" => @iban, "title" => @title, "amount" => @amount.to_decimal.to_f } end |