Class: Merge::Accounting::ExternalTargetFieldApiResponse

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account: OMIT, accounting_attachment: OMIT, balance_sheet: OMIT, cash_flow_statement: OMIT, company_info: OMIT, contact: OMIT, income_statement: OMIT, credit_note: OMIT, item: OMIT, purchase_order: OMIT, tracking_category: OMIT, journal_entry: OMIT, tax_rate: OMIT, invoice: OMIT, payment: OMIT, expense: OMIT, vendor_credit: OMIT, transaction: OMIT, general_ledger_transaction: OMIT, additional_properties: nil) ⇒ Merge::Accounting::ExternalTargetFieldApiResponse

Parameters:



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 77

def initialize(account: OMIT, accounting_attachment: OMIT, balance_sheet: OMIT, cash_flow_statement: OMIT,
               company_info: OMIT, contact: OMIT, income_statement: OMIT, credit_note: OMIT, item: OMIT, purchase_order: OMIT, tracking_category: OMIT, journal_entry: OMIT, tax_rate: OMIT, invoice: OMIT, payment: OMIT, expense: OMIT, vendor_credit: OMIT, transaction: OMIT, general_ledger_transaction: OMIT, additional_properties: nil)
  @account =  if  != OMIT
  @accounting_attachment = accounting_attachment if accounting_attachment != OMIT
  @balance_sheet = balance_sheet if balance_sheet != OMIT
  @cash_flow_statement = cash_flow_statement if cash_flow_statement != OMIT
  @company_info = company_info if company_info != OMIT
  @contact = contact if contact != OMIT
  @income_statement = income_statement if income_statement != OMIT
  @credit_note = credit_note if credit_note != OMIT
  @item = item if item != OMIT
  @purchase_order = purchase_order if purchase_order != OMIT
  @tracking_category = tracking_category if tracking_category != OMIT
  @journal_entry = journal_entry if journal_entry != OMIT
  @tax_rate = tax_rate if tax_rate != OMIT
  @invoice = invoice if invoice != OMIT
  @payment = payment if payment != OMIT
  @expense = expense if expense != OMIT
  @vendor_credit = vendor_credit if vendor_credit != OMIT
  @transaction = transaction if transaction != OMIT
  @general_ledger_transaction = general_ledger_transaction if general_ledger_transaction != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "Account": ,
    "AccountingAttachment": accounting_attachment,
    "BalanceSheet": balance_sheet,
    "CashFlowStatement": cash_flow_statement,
    "CompanyInfo": company_info,
    "Contact": contact,
    "IncomeStatement": income_statement,
    "CreditNote": credit_note,
    "Item": item,
    "PurchaseOrder": purchase_order,
    "TrackingCategory": tracking_category,
    "JournalEntry": journal_entry,
    "TaxRate": tax_rate,
    "Invoice": invoice,
    "Payment": payment,
    "Expense": expense,
    "VendorCredit": vendor_credit,
    "Transaction": transaction,
    "GeneralLedgerTransaction": general_ledger_transaction
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#accountArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



11
12
13
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 11

def 
  @account
end

#accounting_attachmentArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



13
14
15
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 13

def accounting_attachment
  @accounting_attachment
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



49
50
51
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 49

def additional_properties
  @additional_properties
end

#balance_sheetArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



15
16
17
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 15

def balance_sheet
  @balance_sheet
end

#cash_flow_statementArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



17
18
19
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 17

def cash_flow_statement
  @cash_flow_statement
end

#company_infoArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



19
20
21
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 19

def company_info
  @company_info
end

#contactArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



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

def contact
  @contact
end

#credit_noteArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



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

def credit_note
  @credit_note
end

#expenseArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



41
42
43
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 41

def expense
  @expense
end

#general_ledger_transactionArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



47
48
49
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 47

def general_ledger_transaction
  @general_ledger_transaction
end

#income_statementArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



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

def income_statement
  @income_statement
end

#invoiceArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



37
38
39
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 37

def invoice
  @invoice
end

#itemArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



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

def item
  @item
end

#journal_entryArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



33
34
35
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 33

def journal_entry
  @journal_entry
end

#paymentArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



39
40
41
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 39

def payment
  @payment
end

#purchase_orderArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



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

def purchase_order
  @purchase_order
end

#tax_rateArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



35
36
37
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 35

def tax_rate
  @tax_rate
end

#tracking_categoryArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



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

def tracking_category
  @tracking_category
end

#transactionArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



45
46
47
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 45

def transaction
  @transaction
end

#vendor_creditArray<Merge::Accounting::ExternalTargetFieldApi> (readonly)



43
44
45
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 43

def vendor_credit
  @vendor_credit
end

Class Method Details

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

Deserialize a JSON object to an instance of ExternalTargetFieldApiResponse

Parameters:

  • json_object (String)

Returns:



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 128

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
   = parsed_json["Account"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  accounting_attachment = parsed_json["AccountingAttachment"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  balance_sheet = parsed_json["BalanceSheet"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  cash_flow_statement = parsed_json["CashFlowStatement"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  company_info = parsed_json["CompanyInfo"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  contact = parsed_json["Contact"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  income_statement = parsed_json["IncomeStatement"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  credit_note = parsed_json["CreditNote"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  item = parsed_json["Item"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  purchase_order = parsed_json["PurchaseOrder"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  tracking_category = parsed_json["TrackingCategory"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  journal_entry = parsed_json["JournalEntry"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  tax_rate = parsed_json["TaxRate"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  invoice = parsed_json["Invoice"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  payment = parsed_json["Payment"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  expense = parsed_json["Expense"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  vendor_credit = parsed_json["VendorCredit"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  transaction = parsed_json["Transaction"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  general_ledger_transaction = parsed_json["GeneralLedgerTransaction"]&.map do |item|
    item = item.to_json
    Merge::Accounting::ExternalTargetFieldApi.from_json(json_object: item)
  end
  new(
    account: ,
    accounting_attachment: accounting_attachment,
    balance_sheet: balance_sheet,
    cash_flow_statement: cash_flow_statement,
    company_info: company_info,
    contact: contact,
    income_statement: income_statement,
    credit_note: credit_note,
    item: item,
    purchase_order: purchase_order,
    tracking_category: tracking_category,
    journal_entry: journal_entry,
    tax_rate: tax_rate,
    invoice: invoice,
    payment: payment,
    expense: expense,
    vendor_credit: vendor_credit,
    transaction: transaction,
    general_ledger_transaction: general_ledger_transaction,
    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)


244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 244

def self.validate_raw(obj:)
  obj.&.is_a?(Array) != false || raise("Passed value for field obj.account is not the expected type, validation failed.")
  obj.accounting_attachment&.is_a?(Array) != false || raise("Passed value for field obj.accounting_attachment is not the expected type, validation failed.")
  obj.balance_sheet&.is_a?(Array) != false || raise("Passed value for field obj.balance_sheet is not the expected type, validation failed.")
  obj.cash_flow_statement&.is_a?(Array) != false || raise("Passed value for field obj.cash_flow_statement is not the expected type, validation failed.")
  obj.company_info&.is_a?(Array) != false || raise("Passed value for field obj.company_info is not the expected type, validation failed.")
  obj.contact&.is_a?(Array) != false || raise("Passed value for field obj.contact is not the expected type, validation failed.")
  obj.income_statement&.is_a?(Array) != false || raise("Passed value for field obj.income_statement is not the expected type, validation failed.")
  obj.credit_note&.is_a?(Array) != false || raise("Passed value for field obj.credit_note is not the expected type, validation failed.")
  obj.item&.is_a?(Array) != false || raise("Passed value for field obj.item is not the expected type, validation failed.")
  obj.purchase_order&.is_a?(Array) != false || raise("Passed value for field obj.purchase_order is not the expected type, validation failed.")
  obj.tracking_category&.is_a?(Array) != false || raise("Passed value for field obj.tracking_category is not the expected type, validation failed.")
  obj.journal_entry&.is_a?(Array) != false || raise("Passed value for field obj.journal_entry is not the expected type, validation failed.")
  obj.tax_rate&.is_a?(Array) != false || raise("Passed value for field obj.tax_rate is not the expected type, validation failed.")
  obj.invoice&.is_a?(Array) != false || raise("Passed value for field obj.invoice is not the expected type, validation failed.")
  obj.payment&.is_a?(Array) != false || raise("Passed value for field obj.payment is not the expected type, validation failed.")
  obj.expense&.is_a?(Array) != false || raise("Passed value for field obj.expense is not the expected type, validation failed.")
  obj.vendor_credit&.is_a?(Array) != false || raise("Passed value for field obj.vendor_credit is not the expected type, validation failed.")
  obj.transaction&.is_a?(Array) != false || raise("Passed value for field obj.transaction is not the expected type, validation failed.")
  obj.general_ledger_transaction&.is_a?(Array) != false || raise("Passed value for field obj.general_ledger_transaction is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ExternalTargetFieldApiResponse to a JSON object

Returns:

  • (String)


234
235
236
# File 'lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb', line 234

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