Class: Merge::Accounting::BankFeedTransactionRequestRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb

Overview

# The BankFeedTransaction Object

### Description
The `BankFeedTransaction` object is used to represent transactions linked to a
bank feed account. This includes details about the transaction such as the date,
amount, description, and type.
### Usage Example
Fetch from the `GET BankFeedTransaction` endpoint to view details of a
transaction associated with a bank feed account.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bank_feed_account: OMIT, transaction_date: OMIT, posted_date: OMIT, amount: OMIT, description: OMIT, transaction_type: OMIT, payee: OMIT, credit_or_debit: OMIT, source_transaction_id: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil) ⇒ Merge::Accounting::BankFeedTransactionRequestRequest

Parameters:

  • bank_feed_account (Merge::Accounting::BankFeedTransactionRequestRequestBankFeedAccount) (defaults to: OMIT)

    The bank feed account associated with the transaction.

  • transaction_date (DateTime) (defaults to: OMIT)

    The date that the transaction occurred.

  • posted_date (DateTime) (defaults to: OMIT)

    The date the transaction was posted to the bank account.

  • amount (Float) (defaults to: OMIT)

    The amount of the transaction.

  • description (String) (defaults to: OMIT)

    The description of the transaction.

  • transaction_type (String) (defaults to: OMIT)

    The underlying type of the transaction.

  • payee (String) (defaults to: OMIT)

    The person or merchant who initiated the transaction, or alternatively, to whom the transaction was paid.

  • credit_or_debit (Merge::Accounting::CreditOrDebitEnum) (defaults to: OMIT)

    If the transaction is of type debit or credit.

    • ‘CREDIT` - CREDIT

    • ‘DEBIT` - DEBIT

  • source_transaction_id (String) (defaults to: OMIT)

    The customer’s identifier for the transaction.

  • integration_params (Hash{String => Object}) (defaults to: OMIT)
  • linked_account_params (Hash{String => Object}) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 69

def initialize(bank_feed_account: OMIT, transaction_date: OMIT, posted_date: OMIT, amount: OMIT,
               description: OMIT, transaction_type: OMIT, payee: OMIT, credit_or_debit: OMIT, source_transaction_id: OMIT, integration_params: OMIT, linked_account_params: OMIT, additional_properties: nil)
  @bank_feed_account =  if  != OMIT
  @transaction_date = transaction_date if transaction_date != OMIT
  @posted_date = posted_date if posted_date != OMIT
  @amount = amount if amount != OMIT
  @description = description if description != OMIT
  @transaction_type = transaction_type if transaction_type != OMIT
  @payee = payee if payee != OMIT
  @credit_or_debit = credit_or_debit if credit_or_debit != OMIT
  @source_transaction_id = source_transaction_id if source_transaction_id != OMIT
  @integration_params = integration_params if integration_params != OMIT
  @linked_account_params =  if  != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "bank_feed_account": ,
    "transaction_date": transaction_date,
    "posted_date": posted_date,
    "amount": amount,
    "description": description,
    "transaction_type": transaction_type,
    "payee": payee,
    "credit_or_debit": credit_or_debit,
    "source_transaction_id": source_transaction_id,
    "integration_params": integration_params,
    "linked_account_params": 
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



46
47
48
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 46

def additional_properties
  @additional_properties
end

#amountFloat (readonly)

Returns The amount of the transaction.

Returns:

  • (Float)

    The amount of the transaction.



27
28
29
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 27

def amount
  @amount
end

#bank_feed_accountMerge::Accounting::BankFeedTransactionRequestRequestBankFeedAccount (readonly)

Returns The bank feed account associated with the transaction.

Returns:



21
22
23
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 21

def 
  @bank_feed_account
end

#credit_or_debitMerge::Accounting::CreditOrDebitEnum (readonly)

Returns If the transaction is of type debit or credit.

  • ‘CREDIT` - CREDIT

  • ‘DEBIT` - DEBIT.

Returns:



38
39
40
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 38

def credit_or_debit
  @credit_or_debit
end

#descriptionString (readonly)

Returns The description of the transaction.

Returns:

  • (String)

    The description of the transaction.



29
30
31
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 29

def description
  @description
end

#integration_paramsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


42
43
44
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 42

def integration_params
  @integration_params
end

#linked_account_paramsHash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


44
45
46
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 44

def 
  @linked_account_params
end

#payeeString (readonly)

Returns The person or merchant who initiated the transaction, or alternatively, to whom the transaction was paid.

Returns:

  • (String)

    The person or merchant who initiated the transaction, or alternatively, to whom the transaction was paid.



34
35
36
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 34

def payee
  @payee
end

#posted_dateDateTime (readonly)

Returns The date the transaction was posted to the bank account.

Returns:

  • (DateTime)

    The date the transaction was posted to the bank account.



25
26
27
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 25

def posted_date
  @posted_date
end

#source_transaction_idString (readonly)

Returns The customer’s identifier for the transaction.

Returns:

  • (String)

    The customer’s identifier for the transaction.



40
41
42
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 40

def source_transaction_id
  @source_transaction_id
end

#transaction_dateDateTime (readonly)

Returns The date that the transaction occurred.

Returns:

  • (DateTime)

    The date that the transaction occurred.



23
24
25
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 23

def transaction_date
  @transaction_date
end

#transaction_typeString (readonly)

Returns The underlying type of the transaction.

Returns:

  • (String)

    The underlying type of the transaction.



31
32
33
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 31

def transaction_type
  @transaction_type
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Accounting::BankFeedTransactionRequestRequest

Deserialize a JSON object to an instance of BankFeedTransactionRequestRequest

Parameters:

  • json_object (String)

Returns:



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 104

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["bank_feed_account"].nil?
     = nil
  else
     = parsed_json["bank_feed_account"].to_json
     = Merge::Accounting::BankFeedTransactionRequestRequestBankFeedAccount.from_json(json_object: )
  end
  transaction_date = (DateTime.parse(parsed_json["transaction_date"]) unless parsed_json["transaction_date"].nil?)
  posted_date = (DateTime.parse(parsed_json["posted_date"]) unless parsed_json["posted_date"].nil?)
  amount = parsed_json["amount"]
  description = parsed_json["description"]
  transaction_type = parsed_json["transaction_type"]
  payee = parsed_json["payee"]
  credit_or_debit = parsed_json["credit_or_debit"]
  source_transaction_id = parsed_json["source_transaction_id"]
  integration_params = parsed_json["integration_params"]
   = parsed_json["linked_account_params"]
  new(
    bank_feed_account: ,
    transaction_date: transaction_date,
    posted_date: posted_date,
    amount: amount,
    description: description,
    transaction_type: transaction_type,
    payee: payee,
    credit_or_debit: credit_or_debit,
    source_transaction_id: source_transaction_id,
    integration_params: integration_params,
    linked_account_params: ,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 152

def self.validate_raw(obj:)
  obj..nil? || Merge::Accounting::BankFeedTransactionRequestRequestBankFeedAccount.validate_raw(obj: obj.)
  obj.transaction_date&.is_a?(DateTime) != false || raise("Passed value for field obj.transaction_date is not the expected type, validation failed.")
  obj.posted_date&.is_a?(DateTime) != false || raise("Passed value for field obj.posted_date is not the expected type, validation failed.")
  obj.amount&.is_a?(Float) != false || raise("Passed value for field obj.amount is not the expected type, validation failed.")
  obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
  obj.transaction_type&.is_a?(String) != false || raise("Passed value for field obj.transaction_type is not the expected type, validation failed.")
  obj.payee&.is_a?(String) != false || raise("Passed value for field obj.payee is not the expected type, validation failed.")
  obj.credit_or_debit&.is_a?(Merge::Accounting::CreditOrDebitEnum) != false || raise("Passed value for field obj.credit_or_debit is not the expected type, validation failed.")
  obj.source_transaction_id&.is_a?(String) != false || raise("Passed value for field obj.source_transaction_id is not the expected type, validation failed.")
  obj.integration_params&.is_a?(Hash) != false || raise("Passed value for field obj.integration_params is not the expected type, validation failed.")
  obj.&.is_a?(Hash) != false || raise("Passed value for field obj.linked_account_params is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of BankFeedTransactionRequestRequest to a JSON object

Returns:

  • (String)


142
143
144
# File 'lib/merge_ruby_client/accounting/types/bank_feed_transaction_request_request.rb', line 142

def to_json(*_args)
  @_field_set&.to_json
end