merge_ruby_client 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/lib/merge_ruby_client/accounting/accounts/client.rb +16 -8
  3. data/lib/merge_ruby_client/accounting/audit_trail/client.rb +6 -4
  4. data/lib/merge_ruby_client/accounting/client.rb +7 -0
  5. data/lib/merge_ruby_client/accounting/contacts/client.rb +14 -6
  6. data/lib/merge_ruby_client/accounting/expenses/client.rb +12 -4
  7. data/lib/merge_ruby_client/accounting/invoices/client.rb +12 -4
  8. data/lib/merge_ruby_client/accounting/items/client.rb +332 -0
  9. data/lib/merge_ruby_client/accounting/journal_entries/client.rb +12 -4
  10. data/lib/merge_ruby_client/accounting/payments/client.rb +12 -4
  11. data/lib/merge_ruby_client/accounting/projects/client.rb +224 -0
  12. data/lib/merge_ruby_client/accounting/projects/types/projects_list_request_expand.rb +13 -0
  13. data/lib/merge_ruby_client/accounting/projects/types/projects_retrieve_request_expand.rb +13 -0
  14. data/lib/merge_ruby_client/accounting/purchase_orders/client.rb +12 -4
  15. data/lib/merge_ruby_client/accounting/tracking_categories/client.rb +16 -8
  16. data/lib/merge_ruby_client/accounting/types/account_details_and_actions.rb +10 -2
  17. data/lib/merge_ruby_client/accounting/types/audit_log_event.rb +2 -0
  18. data/lib/merge_ruby_client/accounting/types/credit_note_line_item.rb +29 -1
  19. data/lib/merge_ruby_client/accounting/types/credit_note_line_item_contact.rb +56 -0
  20. data/lib/merge_ruby_client/accounting/types/credit_note_line_item_project.rb +55 -0
  21. data/lib/merge_ruby_client/accounting/types/credit_note_line_item_request.rb +29 -1
  22. data/lib/merge_ruby_client/accounting/types/credit_note_line_item_request_contact.rb +56 -0
  23. data/lib/merge_ruby_client/accounting/types/credit_note_line_item_request_project.rb +55 -0
  24. data/lib/merge_ruby_client/accounting/types/event_type_enum.rb +2 -0
  25. data/lib/merge_ruby_client/accounting/types/expense_line.rb +15 -1
  26. data/lib/merge_ruby_client/accounting/types/expense_line_project.rb +55 -0
  27. data/lib/merge_ruby_client/accounting/types/expense_line_request.rb +15 -1
  28. data/lib/merge_ruby_client/accounting/types/expense_line_request_project.rb +55 -0
  29. data/lib/merge_ruby_client/accounting/types/external_target_field_api_response.rb +12 -1
  30. data/lib/merge_ruby_client/accounting/types/field_mapping_api_instance_response.rb +12 -1
  31. data/lib/merge_ruby_client/accounting/types/general_ledger_transaction_line.rb +15 -1
  32. data/lib/merge_ruby_client/accounting/types/general_ledger_transaction_line_project.rb +55 -0
  33. data/lib/merge_ruby_client/accounting/types/invoice_line_item.rb +29 -1
  34. data/lib/merge_ruby_client/accounting/types/invoice_line_item_contact.rb +56 -0
  35. data/lib/merge_ruby_client/accounting/types/invoice_line_item_project.rb +55 -0
  36. data/lib/merge_ruby_client/accounting/types/invoice_line_item_request.rb +29 -1
  37. data/lib/merge_ruby_client/accounting/types/invoice_line_item_request_contact.rb +56 -0
  38. data/lib/merge_ruby_client/accounting/types/invoice_line_item_request_project.rb +55 -0
  39. data/lib/merge_ruby_client/accounting/types/item_request_request.rb +202 -0
  40. data/lib/merge_ruby_client/accounting/types/item_request_request_company.rb +56 -0
  41. data/lib/merge_ruby_client/accounting/types/item_request_request_purchase_account.rb +56 -0
  42. data/lib/merge_ruby_client/accounting/types/item_request_request_purchase_tax_rate.rb +56 -0
  43. data/lib/merge_ruby_client/accounting/types/item_request_request_sales_account.rb +56 -0
  44. data/lib/merge_ruby_client/accounting/types/item_request_request_sales_tax_rate.rb +56 -0
  45. data/lib/merge_ruby_client/accounting/types/item_response.rb +101 -0
  46. data/lib/merge_ruby_client/accounting/types/journal_line.rb +15 -1
  47. data/lib/merge_ruby_client/accounting/types/journal_line_project.rb +55 -0
  48. data/lib/merge_ruby_client/accounting/types/journal_line_request.rb +15 -1
  49. data/lib/merge_ruby_client/accounting/types/journal_line_request_project.rb +55 -0
  50. data/lib/merge_ruby_client/accounting/types/paginated_project_list.rb +80 -0
  51. data/lib/merge_ruby_client/accounting/types/patched_item_request_request.rb +172 -0
  52. data/lib/merge_ruby_client/accounting/types/project.rb +162 -0
  53. data/lib/merge_ruby_client/accounting/types/project_company.rb +56 -0
  54. data/lib/merge_ruby_client/accounting/types/project_contact.rb +56 -0
  55. data/lib/merge_ruby_client/accounting/types/remote_field_api_response.rb +12 -1
  56. data/lib/merge_ruby_client/accounting/types/type_2_bb_enum.rb +16 -0
  57. data/lib/merge_ruby_client/accounting/types/vendor_credit_line.rb +29 -1
  58. data/lib/merge_ruby_client/accounting/types/vendor_credit_line_contact.rb +55 -0
  59. data/lib/merge_ruby_client/accounting/types/vendor_credit_line_project.rb +55 -0
  60. data/lib/merge_ruby_client/accounting/types/vendor_credit_line_request.rb +29 -1
  61. data/lib/merge_ruby_client/accounting/types/vendor_credit_line_request_contact.rb +55 -0
  62. data/lib/merge_ruby_client/accounting/types/vendor_credit_line_request_project.rb +55 -0
  63. data/lib/merge_ruby_client/ats/audit_trail/client.rb +6 -4
  64. data/lib/merge_ruby_client/ats/types/account_details_and_actions.rb +10 -2
  65. data/lib/merge_ruby_client/ats/types/audit_log_event.rb +2 -0
  66. data/lib/merge_ruby_client/ats/types/event_type_enum.rb +1 -0
  67. data/lib/merge_ruby_client/crm/accounts/client.rb +6 -2
  68. data/lib/merge_ruby_client/crm/audit_trail/client.rb +6 -4
  69. data/lib/merge_ruby_client/crm/contacts/client.rb +6 -2
  70. data/lib/merge_ruby_client/crm/custom_objects/client.rb +10 -2
  71. data/lib/merge_ruby_client/crm/engagement_types/client.rb +6 -2
  72. data/lib/merge_ruby_client/crm/engagements/client.rb +6 -2
  73. data/lib/merge_ruby_client/crm/leads/client.rb +6 -2
  74. data/lib/merge_ruby_client/crm/notes/client.rb +6 -2
  75. data/lib/merge_ruby_client/crm/opportunities/client.rb +6 -2
  76. data/lib/merge_ruby_client/crm/stages/client.rb +6 -2
  77. data/lib/merge_ruby_client/crm/sync_status/client.rb +20 -6
  78. data/lib/merge_ruby_client/crm/tasks/client.rb +6 -2
  79. data/lib/merge_ruby_client/crm/types/audit_log_event.rb +2 -0
  80. data/lib/merge_ruby_client/crm/types/custom_object_request.rb +26 -3
  81. data/lib/merge_ruby_client/crm/types/event_type_enum.rb +2 -0
  82. data/lib/merge_ruby_client/crm/users/client.rb +6 -2
  83. data/lib/merge_ruby_client/filestorage/audit_trail/client.rb +6 -4
  84. data/lib/merge_ruby_client/filestorage/files/client.rb +48 -12
  85. data/lib/merge_ruby_client/filestorage/files/types/files_download_request_meta_list_request_order_by.rb +14 -0
  86. data/lib/merge_ruby_client/filestorage/files/types/files_list_request_order_by.rb +14 -0
  87. data/lib/merge_ruby_client/filestorage/sync_status/client.rb +20 -6
  88. data/lib/merge_ruby_client/filestorage/types/account_details_and_actions.rb +10 -2
  89. data/lib/merge_ruby_client/filestorage/types/audit_log_event.rb +2 -0
  90. data/lib/merge_ruby_client/filestorage/types/download_request_meta.rb +2 -9
  91. data/lib/merge_ruby_client/filestorage/types/event_type_enum.rb +2 -0
  92. data/lib/merge_ruby_client/filestorage/types/file.rb +13 -1
  93. data/lib/merge_ruby_client/filestorage/types/file_request.rb +13 -1
  94. data/lib/merge_ruby_client/hris/audit_trail/client.rb +6 -4
  95. data/lib/merge_ruby_client/hris/types/account_details_and_actions.rb +10 -2
  96. data/lib/merge_ruby_client/hris/types/audit_log_event.rb +2 -0
  97. data/lib/merge_ruby_client/hris/types/event_type_enum.rb +2 -0
  98. data/lib/merge_ruby_client/ticketing/audit_trail/client.rb +6 -4
  99. data/lib/merge_ruby_client/ticketing/tickets/client.rb +26 -10
  100. data/lib/merge_ruby_client/ticketing/types/account_details_and_actions.rb +10 -2
  101. data/lib/merge_ruby_client/ticketing/types/audit_log_event.rb +2 -0
  102. data/lib/merge_ruby_client/ticketing/types/collection.rb +18 -16
  103. data/lib/merge_ruby_client/ticketing/types/{access_level_enum.rb → collection_access_level_enum.rb} +3 -1
  104. data/lib/merge_ruby_client/ticketing/types/event_type_enum.rb +2 -0
  105. data/lib/merge_ruby_client/ticketing/types/patched_ticket_request.rb +20 -1
  106. data/lib/merge_ruby_client/ticketing/types/ticket.rb +20 -1
  107. data/lib/merge_ruby_client/ticketing/types/ticket_access_level_enum.rb +16 -0
  108. data/lib/merge_ruby_client/ticketing/types/ticket_request.rb +20 -1
  109. data/lib/merge_ruby_client.rb +7 -7
  110. data/lib/requests.rb +2 -2
  111. data/lib/types_export.rb +243 -208
  112. metadata +39 -3
@@ -54,6 +54,8 @@ module Merge
54
54
  # @return [Array<Merge::Accounting::FieldMappingApiInstance>]
55
55
  attr_reader :payment_method
56
56
  # @return [Array<Merge::Accounting::FieldMappingApiInstance>]
57
+ attr_reader :project
58
+ # @return [Array<Merge::Accounting::FieldMappingApiInstance>]
57
59
  attr_reader :payment_term
58
60
  # @return [OpenStruct] Additional properties unmapped to the current class definition
59
61
  attr_reader :additional_properties
@@ -86,11 +88,12 @@ module Merge
86
88
  # @param bank_feed_account [Array<Merge::Accounting::FieldMappingApiInstance>]
87
89
  # @param employee [Array<Merge::Accounting::FieldMappingApiInstance>]
88
90
  # @param payment_method [Array<Merge::Accounting::FieldMappingApiInstance>]
91
+ # @param project [Array<Merge::Accounting::FieldMappingApiInstance>]
89
92
  # @param payment_term [Array<Merge::Accounting::FieldMappingApiInstance>]
90
93
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
91
94
  # @return [Merge::Accounting::FieldMappingApiInstanceResponse]
92
95
  def initialize(account: OMIT, accounting_attachment: OMIT, balance_sheet: OMIT, cash_flow_statement: OMIT,
93
- 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, accounting_period: OMIT, general_ledger_transaction: OMIT, bank_feed_account: OMIT, employee: OMIT, payment_method: OMIT, payment_term: OMIT, additional_properties: nil)
96
+ 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, accounting_period: OMIT, general_ledger_transaction: OMIT, bank_feed_account: OMIT, employee: OMIT, payment_method: OMIT, project: OMIT, payment_term: OMIT, additional_properties: nil)
94
97
  @account = account if account != OMIT
95
98
  @accounting_attachment = accounting_attachment if accounting_attachment != OMIT
96
99
  @balance_sheet = balance_sheet if balance_sheet != OMIT
@@ -114,6 +117,7 @@ module Merge
114
117
  @bank_feed_account = bank_feed_account if bank_feed_account != OMIT
115
118
  @employee = employee if employee != OMIT
116
119
  @payment_method = payment_method if payment_method != OMIT
120
+ @project = project if project != OMIT
117
121
  @payment_term = payment_term if payment_term != OMIT
118
122
  @additional_properties = additional_properties
119
123
  @_field_set = {
@@ -140,6 +144,7 @@ module Merge
140
144
  "BankFeedAccount": bank_feed_account,
141
145
  "Employee": employee,
142
146
  "PaymentMethod": payment_method,
147
+ "Project": project,
143
148
  "PaymentTerm": payment_term
144
149
  }.reject do |_k, v|
145
150
  v == OMIT
@@ -245,6 +250,10 @@ module Merge
245
250
  item = item.to_json
246
251
  Merge::Accounting::FieldMappingApiInstance.from_json(json_object: item)
247
252
  end
253
+ project = parsed_json["Project"]&.map do |item|
254
+ item = item.to_json
255
+ Merge::Accounting::FieldMappingApiInstance.from_json(json_object: item)
256
+ end
248
257
  payment_term = parsed_json["PaymentTerm"]&.map do |item|
249
258
  item = item.to_json
250
259
  Merge::Accounting::FieldMappingApiInstance.from_json(json_object: item)
@@ -273,6 +282,7 @@ module Merge
273
282
  bank_feed_account: bank_feed_account,
274
283
  employee: employee,
275
284
  payment_method: payment_method,
285
+ project: project,
276
286
  payment_term: payment_term,
277
287
  additional_properties: struct
278
288
  )
@@ -315,6 +325,7 @@ module Merge
315
325
  obj.bank_feed_account&.is_a?(Array) != false || raise("Passed value for field obj.bank_feed_account is not the expected type, validation failed.")
316
326
  obj.employee&.is_a?(Array) != false || raise("Passed value for field obj.employee is not the expected type, validation failed.")
317
327
  obj.payment_method&.is_a?(Array) != false || raise("Passed value for field obj.payment_method is not the expected type, validation failed.")
328
+ obj.project&.is_a?(Array) != false || raise("Passed value for field obj.project is not the expected type, validation failed.")
318
329
  obj.payment_term&.is_a?(Array) != false || raise("Passed value for field obj.payment_term is not the expected type, validation failed.")
319
330
  end
320
331
  end
@@ -5,6 +5,7 @@ require_relative "general_ledger_transaction_line_account"
5
5
  require_relative "general_ledger_transaction_line_company"
6
6
  require_relative "general_ledger_transaction_line_employee"
7
7
  require_relative "general_ledger_transaction_line_contact"
8
+ require_relative "general_ledger_transaction_line_project"
8
9
  require_relative "transaction_currency_enum"
9
10
  require_relative "general_ledger_transaction_line_tracking_categories_item"
10
11
  require_relative "general_ledger_transaction_line_item"
@@ -37,6 +38,8 @@ module Merge
37
38
  attr_reader :employee
38
39
  # @return [Merge::Accounting::GeneralLedgerTransactionLineContact]
39
40
  attr_reader :contact
41
+ # @return [Merge::Accounting::GeneralLedgerTransactionLineProject]
42
+ attr_reader :project
40
43
  # @return [Merge::Accounting::TransactionCurrencyEnum] The base currency of the transaction
41
44
  # * `XUA` - ADB Unit of Account
42
45
  # * `AFN` - Afghan Afghani
@@ -692,6 +695,7 @@ module Merge
692
695
  # @param company [Merge::Accounting::GeneralLedgerTransactionLineCompany] The company the GeneralLedgerTransaction belongs to.
693
696
  # @param employee [Merge::Accounting::GeneralLedgerTransactionLineEmployee]
694
697
  # @param contact [Merge::Accounting::GeneralLedgerTransactionLineContact]
698
+ # @param project [Merge::Accounting::GeneralLedgerTransactionLineProject]
695
699
  # @param base_currency [Merge::Accounting::TransactionCurrencyEnum] The base currency of the transaction
696
700
  # * `XUA` - ADB Unit of Account
697
701
  # * `AFN` - Afghan Afghani
@@ -1322,7 +1326,7 @@ module Merge
1322
1326
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
1323
1327
  # @return [Merge::Accounting::GeneralLedgerTransactionLine]
1324
1328
  def initialize(debit_amount:, credit_amount:, foreign_debit_amount:, foreign_credit_amount:, id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, account: OMIT, company: OMIT,
1325
- employee: OMIT, contact: OMIT, base_currency: OMIT, transaction_currency: OMIT, exchange_rate: OMIT, description: OMIT, tracking_categories: OMIT, item: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, additional_properties: nil)
1329
+ employee: OMIT, contact: OMIT, project: OMIT, base_currency: OMIT, transaction_currency: OMIT, exchange_rate: OMIT, description: OMIT, tracking_categories: OMIT, item: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, additional_properties: nil)
1326
1330
  @id = id if id != OMIT
1327
1331
  @remote_id = remote_id if remote_id != OMIT
1328
1332
  @created_at = created_at if created_at != OMIT
@@ -1331,6 +1335,7 @@ module Merge
1331
1335
  @company = company if company != OMIT
1332
1336
  @employee = employee if employee != OMIT
1333
1337
  @contact = contact if contact != OMIT
1338
+ @project = project if project != OMIT
1334
1339
  @base_currency = base_currency if base_currency != OMIT
1335
1340
  @transaction_currency = transaction_currency if transaction_currency != OMIT
1336
1341
  @exchange_rate = exchange_rate if exchange_rate != OMIT
@@ -1353,6 +1358,7 @@ module Merge
1353
1358
  "company": company,
1354
1359
  "employee": employee,
1355
1360
  "contact": contact,
1361
+ "project": project,
1356
1362
  "base_currency": base_currency,
1357
1363
  "transaction_currency": transaction_currency,
1358
1364
  "exchange_rate": exchange_rate,
@@ -1405,6 +1411,12 @@ module Merge
1405
1411
  contact = parsed_json["contact"].to_json
1406
1412
  contact = Merge::Accounting::GeneralLedgerTransactionLineContact.from_json(json_object: contact)
1407
1413
  end
1414
+ if parsed_json["project"].nil?
1415
+ project = nil
1416
+ else
1417
+ project = parsed_json["project"].to_json
1418
+ project = Merge::Accounting::GeneralLedgerTransactionLineProject.from_json(json_object: project)
1419
+ end
1408
1420
  base_currency = parsed_json["base_currency"]
1409
1421
  transaction_currency = parsed_json["transaction_currency"]
1410
1422
  exchange_rate = parsed_json["exchange_rate"]
@@ -1434,6 +1446,7 @@ module Merge
1434
1446
  company: company,
1435
1447
  employee: employee,
1436
1448
  contact: contact,
1449
+ project: project,
1437
1450
  base_currency: base_currency,
1438
1451
  transaction_currency: transaction_currency,
1439
1452
  exchange_rate: exchange_rate,
@@ -1472,6 +1485,7 @@ module Merge
1472
1485
  obj.company.nil? || Merge::Accounting::GeneralLedgerTransactionLineCompany.validate_raw(obj: obj.company)
1473
1486
  obj.employee.nil? || Merge::Accounting::GeneralLedgerTransactionLineEmployee.validate_raw(obj: obj.employee)
1474
1487
  obj.contact.nil? || Merge::Accounting::GeneralLedgerTransactionLineContact.validate_raw(obj: obj.contact)
1488
+ obj.project.nil? || Merge::Accounting::GeneralLedgerTransactionLineProject.validate_raw(obj: obj.project)
1475
1489
  obj.base_currency&.is_a?(Merge::Accounting::TransactionCurrencyEnum) != false || raise("Passed value for field obj.base_currency is not the expected type, validation failed.")
1476
1490
  obj.transaction_currency&.is_a?(Merge::Accounting::TransactionCurrencyEnum) != false || raise("Passed value for field obj.transaction_currency is not the expected type, validation failed.")
1477
1491
  obj.exchange_rate&.is_a?(String) != false || raise("Passed value for field obj.exchange_rate is not the expected type, validation failed.")
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require_relative "project"
5
+
6
+ module Merge
7
+ module Accounting
8
+ class GeneralLedgerTransactionLineProject
9
+ # Deserialize a JSON object to an instance of GeneralLedgerTransactionLineProject
10
+ #
11
+ # @param json_object [String]
12
+ # @return [Merge::Accounting::GeneralLedgerTransactionLineProject]
13
+ def self.from_json(json_object:)
14
+ struct = JSON.parse(json_object, object_class: OpenStruct)
15
+ begin
16
+ struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.")
17
+ return struct unless struct.nil?
18
+
19
+ return nil
20
+ rescue StandardError
21
+ # noop
22
+ end
23
+ begin
24
+ Merge::Accounting::Project.validate_raw(obj: struct)
25
+ return Merge::Accounting::Project.from_json(json_object: struct) unless struct.nil?
26
+
27
+ return nil
28
+ rescue StandardError
29
+ # noop
30
+ end
31
+ struct
32
+ end
33
+
34
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
35
+ # hash and check each fields type against the current object's property
36
+ # definitions.
37
+ #
38
+ # @param obj [Object]
39
+ # @return [Void]
40
+ def self.validate_raw(obj:)
41
+ begin
42
+ return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.")
43
+ rescue StandardError
44
+ # noop
45
+ end
46
+ begin
47
+ return Merge::Accounting::Project.validate_raw(obj: obj)
48
+ rescue StandardError
49
+ # noop
50
+ end
51
+ raise("Passed value matched no type within the union, validation failed.")
52
+ end
53
+ end
54
+ end
55
+ end
@@ -2,6 +2,8 @@
2
2
 
3
3
  require "date"
4
4
  require_relative "invoice_line_item_employee"
5
+ require_relative "invoice_line_item_project"
6
+ require_relative "invoice_line_item_contact"
5
7
  require_relative "transaction_currency_enum"
6
8
  require_relative "invoice_line_item_item"
7
9
  require_relative "invoice_line_item_account"
@@ -38,6 +40,10 @@ module Merge
38
40
  attr_reader :total_amount
39
41
  # @return [Merge::Accounting::InvoiceLineItemEmployee] The employee this overall transaction relates to.
40
42
  attr_reader :employee
43
+ # @return [Merge::Accounting::InvoiceLineItemProject]
44
+ attr_reader :project
45
+ # @return [Merge::Accounting::InvoiceLineItemContact] The invoice's contact.
46
+ attr_reader :contact
41
47
  # @return [Merge::Accounting::TransactionCurrencyEnum] The line item's currency.
42
48
  # * `XUA` - ADB Unit of Account
43
49
  # * `AFN` - Afghan Afghani
@@ -386,6 +392,8 @@ module Merge
386
392
  # @param quantity [Float] The line item's quantity.
387
393
  # @param total_amount [Float] The line item's total amount.
388
394
  # @param employee [Merge::Accounting::InvoiceLineItemEmployee] The employee this overall transaction relates to.
395
+ # @param project [Merge::Accounting::InvoiceLineItemProject]
396
+ # @param contact [Merge::Accounting::InvoiceLineItemContact] The invoice's contact.
389
397
  # @param currency [Merge::Accounting::TransactionCurrencyEnum] The line item's currency.
390
398
  # * `XUA` - ADB Unit of Account
391
399
  # * `AFN` - Afghan Afghani
@@ -709,7 +717,7 @@ module Merge
709
717
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
710
718
  # @return [Merge::Accounting::InvoiceLineItem]
711
719
  def initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, description: OMIT,
712
- unit_price: OMIT, quantity: OMIT, total_amount: OMIT, employee: OMIT, currency: OMIT, exchange_rate: OMIT, item: OMIT, account: OMIT, tax_rate: OMIT, tracking_category: OMIT, tracking_categories: OMIT, company: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_fields: OMIT, additional_properties: nil)
720
+ unit_price: OMIT, quantity: OMIT, total_amount: OMIT, employee: OMIT, project: OMIT, contact: OMIT, currency: OMIT, exchange_rate: OMIT, item: OMIT, account: OMIT, tax_rate: OMIT, tracking_category: OMIT, tracking_categories: OMIT, company: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_fields: OMIT, additional_properties: nil)
713
721
  @id = id if id != OMIT
714
722
  @remote_id = remote_id if remote_id != OMIT
715
723
  @created_at = created_at if created_at != OMIT
@@ -719,6 +727,8 @@ module Merge
719
727
  @quantity = quantity if quantity != OMIT
720
728
  @total_amount = total_amount if total_amount != OMIT
721
729
  @employee = employee if employee != OMIT
730
+ @project = project if project != OMIT
731
+ @contact = contact if contact != OMIT
722
732
  @currency = currency if currency != OMIT
723
733
  @exchange_rate = exchange_rate if exchange_rate != OMIT
724
734
  @item = item if item != OMIT
@@ -741,6 +751,8 @@ module Merge
741
751
  "quantity": quantity,
742
752
  "total_amount": total_amount,
743
753
  "employee": employee,
754
+ "project": project,
755
+ "contact": contact,
744
756
  "currency": currency,
745
757
  "exchange_rate": exchange_rate,
746
758
  "item": item,
@@ -778,6 +790,18 @@ module Merge
778
790
  employee = parsed_json["employee"].to_json
779
791
  employee = Merge::Accounting::InvoiceLineItemEmployee.from_json(json_object: employee)
780
792
  end
793
+ if parsed_json["project"].nil?
794
+ project = nil
795
+ else
796
+ project = parsed_json["project"].to_json
797
+ project = Merge::Accounting::InvoiceLineItemProject.from_json(json_object: project)
798
+ end
799
+ if parsed_json["contact"].nil?
800
+ contact = nil
801
+ else
802
+ contact = parsed_json["contact"].to_json
803
+ contact = Merge::Accounting::InvoiceLineItemContact.from_json(json_object: contact)
804
+ end
781
805
  currency = parsed_json["currency"]
782
806
  exchange_rate = parsed_json["exchange_rate"]
783
807
  if parsed_json["item"].nil?
@@ -820,6 +844,8 @@ module Merge
820
844
  quantity: quantity,
821
845
  total_amount: total_amount,
822
846
  employee: employee,
847
+ project: project,
848
+ contact: contact,
823
849
  currency: currency,
824
850
  exchange_rate: exchange_rate,
825
851
  item: item,
@@ -858,6 +884,8 @@ module Merge
858
884
  obj.quantity&.is_a?(Float) != false || raise("Passed value for field obj.quantity is not the expected type, validation failed.")
859
885
  obj.total_amount&.is_a?(Float) != false || raise("Passed value for field obj.total_amount is not the expected type, validation failed.")
860
886
  obj.employee.nil? || Merge::Accounting::InvoiceLineItemEmployee.validate_raw(obj: obj.employee)
887
+ obj.project.nil? || Merge::Accounting::InvoiceLineItemProject.validate_raw(obj: obj.project)
888
+ obj.contact.nil? || Merge::Accounting::InvoiceLineItemContact.validate_raw(obj: obj.contact)
861
889
  obj.currency&.is_a?(Merge::Accounting::TransactionCurrencyEnum) != false || raise("Passed value for field obj.currency is not the expected type, validation failed.")
862
890
  obj.exchange_rate&.is_a?(String) != false || raise("Passed value for field obj.exchange_rate is not the expected type, validation failed.")
863
891
  obj.item.nil? || Merge::Accounting::InvoiceLineItemItem.validate_raw(obj: obj.item)
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require_relative "contact"
5
+
6
+ module Merge
7
+ module Accounting
8
+ # The invoice's contact.
9
+ class InvoiceLineItemContact
10
+ # Deserialize a JSON object to an instance of InvoiceLineItemContact
11
+ #
12
+ # @param json_object [String]
13
+ # @return [Merge::Accounting::InvoiceLineItemContact]
14
+ def self.from_json(json_object:)
15
+ struct = JSON.parse(json_object, object_class: OpenStruct)
16
+ begin
17
+ struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.")
18
+ return struct unless struct.nil?
19
+
20
+ return nil
21
+ rescue StandardError
22
+ # noop
23
+ end
24
+ begin
25
+ Merge::Accounting::Contact.validate_raw(obj: struct)
26
+ return Merge::Accounting::Contact.from_json(json_object: struct) unless struct.nil?
27
+
28
+ return nil
29
+ rescue StandardError
30
+ # noop
31
+ end
32
+ struct
33
+ end
34
+
35
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
36
+ # hash and check each fields type against the current object's property
37
+ # definitions.
38
+ #
39
+ # @param obj [Object]
40
+ # @return [Void]
41
+ def self.validate_raw(obj:)
42
+ begin
43
+ return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.")
44
+ rescue StandardError
45
+ # noop
46
+ end
47
+ begin
48
+ return Merge::Accounting::Contact.validate_raw(obj: obj)
49
+ rescue StandardError
50
+ # noop
51
+ end
52
+ raise("Passed value matched no type within the union, validation failed.")
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require_relative "project"
5
+
6
+ module Merge
7
+ module Accounting
8
+ class InvoiceLineItemProject
9
+ # Deserialize a JSON object to an instance of InvoiceLineItemProject
10
+ #
11
+ # @param json_object [String]
12
+ # @return [Merge::Accounting::InvoiceLineItemProject]
13
+ def self.from_json(json_object:)
14
+ struct = JSON.parse(json_object, object_class: OpenStruct)
15
+ begin
16
+ struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.")
17
+ return struct unless struct.nil?
18
+
19
+ return nil
20
+ rescue StandardError
21
+ # noop
22
+ end
23
+ begin
24
+ Merge::Accounting::Project.validate_raw(obj: struct)
25
+ return Merge::Accounting::Project.from_json(json_object: struct) unless struct.nil?
26
+
27
+ return nil
28
+ rescue StandardError
29
+ # noop
30
+ end
31
+ struct
32
+ end
33
+
34
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
35
+ # hash and check each fields type against the current object's property
36
+ # definitions.
37
+ #
38
+ # @param obj [Object]
39
+ # @return [Void]
40
+ def self.validate_raw(obj:)
41
+ begin
42
+ return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.")
43
+ rescue StandardError
44
+ # noop
45
+ end
46
+ begin
47
+ return Merge::Accounting::Project.validate_raw(obj: obj)
48
+ rescue StandardError
49
+ # noop
50
+ end
51
+ raise("Passed value matched no type within the union, validation failed.")
52
+ end
53
+ end
54
+ end
55
+ end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "invoice_line_item_request_employee"
4
+ require_relative "invoice_line_item_request_project"
5
+ require_relative "invoice_line_item_request_contact"
4
6
  require_relative "transaction_currency_enum"
5
7
  require_relative "invoice_line_item_request_item"
6
8
  require_relative "invoice_line_item_request_account"
@@ -31,6 +33,10 @@ module Merge
31
33
  attr_reader :total_amount
32
34
  # @return [Merge::Accounting::InvoiceLineItemRequestEmployee] The employee this overall transaction relates to.
33
35
  attr_reader :employee
36
+ # @return [Merge::Accounting::InvoiceLineItemRequestProject]
37
+ attr_reader :project
38
+ # @return [Merge::Accounting::InvoiceLineItemRequestContact] The invoice's contact.
39
+ attr_reader :contact
34
40
  # @return [Merge::Accounting::TransactionCurrencyEnum] The line item's currency.
35
41
  # * `XUA` - ADB Unit of Account
36
42
  # * `AFN` - Afghan Afghani
@@ -373,6 +379,8 @@ module Merge
373
379
  # @param quantity [Float] The line item's quantity.
374
380
  # @param total_amount [Float] The line item's total amount.
375
381
  # @param employee [Merge::Accounting::InvoiceLineItemRequestEmployee] The employee this overall transaction relates to.
382
+ # @param project [Merge::Accounting::InvoiceLineItemRequestProject]
383
+ # @param contact [Merge::Accounting::InvoiceLineItemRequestContact] The invoice's contact.
376
384
  # @param currency [Merge::Accounting::TransactionCurrencyEnum] The line item's currency.
377
385
  # * `XUA` - ADB Unit of Account
378
386
  # * `AFN` - Afghan Afghani
@@ -693,13 +701,15 @@ module Merge
693
701
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
694
702
  # @return [Merge::Accounting::InvoiceLineItemRequest]
695
703
  def initialize(remote_id: OMIT, description: OMIT, unit_price: OMIT, quantity: OMIT, total_amount: OMIT,
696
- employee: OMIT, currency: OMIT, exchange_rate: OMIT, item: OMIT, account: OMIT, tax_rate: OMIT, tracking_category: OMIT, tracking_categories: OMIT, company: OMIT, integration_params: OMIT, linked_account_params: OMIT, remote_fields: OMIT, additional_properties: nil)
704
+ employee: OMIT, project: OMIT, contact: OMIT, currency: OMIT, exchange_rate: OMIT, item: OMIT, account: OMIT, tax_rate: OMIT, tracking_category: OMIT, tracking_categories: OMIT, company: OMIT, integration_params: OMIT, linked_account_params: OMIT, remote_fields: OMIT, additional_properties: nil)
697
705
  @remote_id = remote_id if remote_id != OMIT
698
706
  @description = description if description != OMIT
699
707
  @unit_price = unit_price if unit_price != OMIT
700
708
  @quantity = quantity if quantity != OMIT
701
709
  @total_amount = total_amount if total_amount != OMIT
702
710
  @employee = employee if employee != OMIT
711
+ @project = project if project != OMIT
712
+ @contact = contact if contact != OMIT
703
713
  @currency = currency if currency != OMIT
704
714
  @exchange_rate = exchange_rate if exchange_rate != OMIT
705
715
  @item = item if item != OMIT
@@ -719,6 +729,8 @@ module Merge
719
729
  "quantity": quantity,
720
730
  "total_amount": total_amount,
721
731
  "employee": employee,
732
+ "project": project,
733
+ "contact": contact,
722
734
  "currency": currency,
723
735
  "exchange_rate": exchange_rate,
724
736
  "item": item,
@@ -753,6 +765,18 @@ module Merge
753
765
  employee = parsed_json["employee"].to_json
754
766
  employee = Merge::Accounting::InvoiceLineItemRequestEmployee.from_json(json_object: employee)
755
767
  end
768
+ if parsed_json["project"].nil?
769
+ project = nil
770
+ else
771
+ project = parsed_json["project"].to_json
772
+ project = Merge::Accounting::InvoiceLineItemRequestProject.from_json(json_object: project)
773
+ end
774
+ if parsed_json["contact"].nil?
775
+ contact = nil
776
+ else
777
+ contact = parsed_json["contact"].to_json
778
+ contact = Merge::Accounting::InvoiceLineItemRequestContact.from_json(json_object: contact)
779
+ end
756
780
  currency = parsed_json["currency"]
757
781
  exchange_rate = parsed_json["exchange_rate"]
758
782
  if parsed_json["item"].nil?
@@ -792,6 +816,8 @@ module Merge
792
816
  quantity: quantity,
793
817
  total_amount: total_amount,
794
818
  employee: employee,
819
+ project: project,
820
+ contact: contact,
795
821
  currency: currency,
796
822
  exchange_rate: exchange_rate,
797
823
  item: item,
@@ -827,6 +853,8 @@ module Merge
827
853
  obj.quantity&.is_a?(Float) != false || raise("Passed value for field obj.quantity is not the expected type, validation failed.")
828
854
  obj.total_amount&.is_a?(Float) != false || raise("Passed value for field obj.total_amount is not the expected type, validation failed.")
829
855
  obj.employee.nil? || Merge::Accounting::InvoiceLineItemRequestEmployee.validate_raw(obj: obj.employee)
856
+ obj.project.nil? || Merge::Accounting::InvoiceLineItemRequestProject.validate_raw(obj: obj.project)
857
+ obj.contact.nil? || Merge::Accounting::InvoiceLineItemRequestContact.validate_raw(obj: obj.contact)
830
858
  obj.currency&.is_a?(Merge::Accounting::TransactionCurrencyEnum) != false || raise("Passed value for field obj.currency is not the expected type, validation failed.")
831
859
  obj.exchange_rate&.is_a?(String) != false || raise("Passed value for field obj.exchange_rate is not the expected type, validation failed.")
832
860
  obj.item.nil? || Merge::Accounting::InvoiceLineItemRequestItem.validate_raw(obj: obj.item)
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require_relative "contact"
5
+
6
+ module Merge
7
+ module Accounting
8
+ # The invoice's contact.
9
+ class InvoiceLineItemRequestContact
10
+ # Deserialize a JSON object to an instance of InvoiceLineItemRequestContact
11
+ #
12
+ # @param json_object [String]
13
+ # @return [Merge::Accounting::InvoiceLineItemRequestContact]
14
+ def self.from_json(json_object:)
15
+ struct = JSON.parse(json_object, object_class: OpenStruct)
16
+ begin
17
+ struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.")
18
+ return struct unless struct.nil?
19
+
20
+ return nil
21
+ rescue StandardError
22
+ # noop
23
+ end
24
+ begin
25
+ Merge::Accounting::Contact.validate_raw(obj: struct)
26
+ return Merge::Accounting::Contact.from_json(json_object: struct) unless struct.nil?
27
+
28
+ return nil
29
+ rescue StandardError
30
+ # noop
31
+ end
32
+ struct
33
+ end
34
+
35
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
36
+ # hash and check each fields type against the current object's property
37
+ # definitions.
38
+ #
39
+ # @param obj [Object]
40
+ # @return [Void]
41
+ def self.validate_raw(obj:)
42
+ begin
43
+ return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.")
44
+ rescue StandardError
45
+ # noop
46
+ end
47
+ begin
48
+ return Merge::Accounting::Contact.validate_raw(obj: obj)
49
+ rescue StandardError
50
+ # noop
51
+ end
52
+ raise("Passed value matched no type within the union, validation failed.")
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require_relative "project"
5
+
6
+ module Merge
7
+ module Accounting
8
+ class InvoiceLineItemRequestProject
9
+ # Deserialize a JSON object to an instance of InvoiceLineItemRequestProject
10
+ #
11
+ # @param json_object [String]
12
+ # @return [Merge::Accounting::InvoiceLineItemRequestProject]
13
+ def self.from_json(json_object:)
14
+ struct = JSON.parse(json_object, object_class: OpenStruct)
15
+ begin
16
+ struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.")
17
+ return struct unless struct.nil?
18
+
19
+ return nil
20
+ rescue StandardError
21
+ # noop
22
+ end
23
+ begin
24
+ Merge::Accounting::Project.validate_raw(obj: struct)
25
+ return Merge::Accounting::Project.from_json(json_object: struct) unless struct.nil?
26
+
27
+ return nil
28
+ rescue StandardError
29
+ # noop
30
+ end
31
+ struct
32
+ end
33
+
34
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
35
+ # hash and check each fields type against the current object's property
36
+ # definitions.
37
+ #
38
+ # @param obj [Object]
39
+ # @return [Void]
40
+ def self.validate_raw(obj:)
41
+ begin
42
+ return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.")
43
+ rescue StandardError
44
+ # noop
45
+ end
46
+ begin
47
+ return Merge::Accounting::Project.validate_raw(obj: obj)
48
+ rescue StandardError
49
+ # noop
50
+ end
51
+ raise("Passed value matched no type within the union, validation failed.")
52
+ end
53
+ end
54
+ end
55
+ end