Class: Unit::Payment::CreateBookPaymentRequest
- Inherits:
-
Object
- Object
- Unit::Payment::CreateBookPaymentRequest
- Defined in:
- lib/unit/models/payment/create_book_payment_request.rb
Instance Attribute Summary collapse
-
#account_id ⇒ Object
readonly
Returns the value of attribute account_id.
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#counterparty_account_id ⇒ Object
readonly
Returns the value of attribute counterparty_account_id.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#idempotency_key ⇒ Object
readonly
Returns the value of attribute idempotency_key.
-
#relationships ⇒ Object
readonly
Returns the value of attribute relationships.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#transaction_summary_override ⇒ Object
readonly
Returns the value of attribute transaction_summary_override.
Instance Method Summary collapse
-
#initialize(amount, description, account_id, counterparty_account_id, relationships, transaction_summary_override = nil, idempotency_key = nil, tags = nil) ⇒ CreateBookPaymentRequest
constructor
A new instance of CreateBookPaymentRequest.
- #to_json_api ⇒ Object
Constructor Details
#initialize(amount, description, account_id, counterparty_account_id, relationships, transaction_summary_override = nil, idempotency_key = nil, tags = nil) ⇒ CreateBookPaymentRequest
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/unit/models/payment/create_book_payment_request.rb', line 17 def initialize(amount, description, account_id, counterparty_account_id, relationships, transaction_summary_override = nil, idempotency_key = nil, = nil) @amount = amount @description = description @account_id = account_id @counterparty_account_id = counterparty_account_id @relationships = relationships @transaction_summary_override = transaction_summary_override @idempotency_key = idempotency_key = end |
Instance Attribute Details
#account_id ⇒ Object (readonly)
Returns the value of attribute account_id.
8 9 10 |
# File 'lib/unit/models/payment/create_book_payment_request.rb', line 8 def account_id @account_id end |
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
8 9 10 |
# File 'lib/unit/models/payment/create_book_payment_request.rb', line 8 def amount @amount end |
#counterparty_account_id ⇒ Object (readonly)
Returns the value of attribute counterparty_account_id.
8 9 10 |
# File 'lib/unit/models/payment/create_book_payment_request.rb', line 8 def counterparty_account_id @counterparty_account_id end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/unit/models/payment/create_book_payment_request.rb', line 8 def description @description end |
#idempotency_key ⇒ Object (readonly)
Returns the value of attribute idempotency_key.
8 9 10 |
# File 'lib/unit/models/payment/create_book_payment_request.rb', line 8 def idempotency_key @idempotency_key end |
#relationships ⇒ Object (readonly)
Returns the value of attribute relationships.
8 9 10 |
# File 'lib/unit/models/payment/create_book_payment_request.rb', line 8 def relationships @relationships end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
8 9 10 |
# File 'lib/unit/models/payment/create_book_payment_request.rb', line 8 def end |
#transaction_summary_override ⇒ Object (readonly)
Returns the value of attribute transaction_summary_override.
8 9 10 |
# File 'lib/unit/models/payment/create_book_payment_request.rb', line 8 def transaction_summary_override @transaction_summary_override end |
Instance Method Details
#to_json_api ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/unit/models/payment/create_book_payment_request.rb', line 29 def to_json_api payload = { data: { type: "bookPayment", attributes: { amount: amount, description: description, transactionSummaryOverride: transaction_summary_override, idempotencyKey: idempotency_key, tags: }, relationships: { account: Unit::Types::Relationship.new("depositAccount", account_id).to_hash, counterpartyAccount: Unit::Types::Relationship.new("depositAccount", counterparty_account_id).to_hash } } } payload[:data][:attributes].compact! payload.to_json end |