Class: Unit::Payment::CreateWirePaymentRequest
- Inherits:
-
Object
- Object
- Unit::Payment::CreateWirePaymentRequest
- Defined in:
- lib/unit/models/payment/create_wire_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 ⇒ Object
readonly
Returns the value of attribute counterparty.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#idempotency_key ⇒ Object
readonly
Returns the value of attribute idempotency_key.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
- #change_attributes ⇒ Object
-
#initialize(account_id:, amount:, description:, counterparty:, idempotency_key: nil, tags: nil) ⇒ CreateWirePaymentRequest
constructor
A new instance of CreateWirePaymentRequest.
- #to_hash ⇒ Object
- #to_json_api ⇒ Object
Constructor Details
#initialize(account_id:, amount:, description:, counterparty:, idempotency_key: nil, tags: nil) ⇒ CreateWirePaymentRequest
Returns a new instance of CreateWirePaymentRequest.
16 17 18 19 20 21 22 23 |
# File 'lib/unit/models/payment/create_wire_payment_request.rb', line 16 def initialize(account_id:, amount:, description:, counterparty:, idempotency_key: nil, tags: nil) @account_id = account_id @amount = amount @description = description @counterparty = counterparty @idempotency_key = idempotency_key @tags = end |
Instance Attribute Details
#account_id ⇒ Object (readonly)
Returns the value of attribute account_id.
8 9 10 |
# File 'lib/unit/models/payment/create_wire_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_wire_payment_request.rb', line 8 def amount @amount end |
#counterparty ⇒ Object (readonly)
Returns the value of attribute counterparty.
8 9 10 |
# File 'lib/unit/models/payment/create_wire_payment_request.rb', line 8 def counterparty @counterparty end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/unit/models/payment/create_wire_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_wire_payment_request.rb', line 8 def idempotency_key @idempotency_key end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
8 9 10 |
# File 'lib/unit/models/payment/create_wire_payment_request.rb', line 8 def @tags end |
Instance Method Details
#change_attributes ⇒ Object
47 48 49 50 51 |
# File 'lib/unit/models/payment/create_wire_payment_request.rb', line 47 def change_attributes payload = to_hash payload[:attributes].compact! payload end |
#to_hash ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/unit/models/payment/create_wire_payment_request.rb', line 33 def to_hash { type: "wirePayment", attributes: { amount: amount, description: description, counterparty: counterparty.represent, idempotencyKey: idempotency_key, tags: }, relationships: { account: Unit::Types::Relationship.new("account", account_id).to_hash } } end |
#to_json_api ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/unit/models/payment/create_wire_payment_request.rb', line 25 def to_json_api payload = { data: to_hash } payload[:data][:attributes].compact! payload.to_json end |