Class: Unit::Transaction::PatchBookTransactionRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/transaction/patch_book_transaction_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_id, transaction_id, summary = nil, tags = nil) ⇒ PatchBookTransactionRequest

Returns a new instance of PatchBookTransactionRequest.

Parameters:

  • account_id (String)
  • transaction_id (String)
  • summary (String) (defaults to: nil)
    • optional

  • tags (Hash) (defaults to: nil)
    • optional



14
15
16
17
18
19
# File 'lib/unit/models/transaction/patch_book_transaction_request.rb', line 14

def initialize(, transaction_id, summary = nil, tags = nil)
  @account_id = 
  @transaction_id = transaction_id
  @summary = summary
  @tags = tags
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



8
9
10
# File 'lib/unit/models/transaction/patch_book_transaction_request.rb', line 8

def 
  @account_id
end

#summaryObject (readonly)

Returns the value of attribute summary.



8
9
10
# File 'lib/unit/models/transaction/patch_book_transaction_request.rb', line 8

def summary
  @summary
end

#tagsObject (readonly)

Returns the value of attribute tags.



8
9
10
# File 'lib/unit/models/transaction/patch_book_transaction_request.rb', line 8

def tags
  @tags
end

#transaction_idObject (readonly)

Returns the value of attribute transaction_id.



8
9
10
# File 'lib/unit/models/transaction/patch_book_transaction_request.rb', line 8

def transaction_id
  @transaction_id
end

Instance Method Details

#to_json_apiObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/unit/models/transaction/patch_book_transaction_request.rb', line 21

def to_json_api
  payload = {
    data: {
      type: "bookTransaction",
      attributes: {
        summary: summary,
        tags: tags
      },
      relationships: {
        account: Unit::Types::Relationship.new("account", ).to_hash
      }
    }
  }
  payload[:data][:attributes].compact!
  payload.to_json
end