merge_accounting_client 1.0.9 → 1.1.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 (182) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -4
  3. data/docs/Account.md +3 -1
  4. data/docs/AccountIntegration.md +4 -2
  5. data/docs/AccountingAttachment.md +3 -1
  6. data/docs/AccountingPeriod.md +30 -0
  7. data/docs/AccountingPeriodStatusEnum.md +15 -0
  8. data/docs/AccountingPeriodsApi.md +167 -0
  9. data/docs/AccountingPhoneNumber.md +2 -0
  10. data/docs/Address.md +2 -0
  11. data/docs/AddressRequest.md +34 -0
  12. data/docs/AuditLogEvent.md +32 -0
  13. data/docs/AuditTrailApi.md +91 -0
  14. data/docs/BalanceSheet.md +3 -1
  15. data/docs/CashFlowStatement.md +3 -1
  16. data/docs/CompanyInfo.md +3 -1
  17. data/docs/Contact.md +4 -2
  18. data/docs/ContactRequest.md +1 -1
  19. data/docs/ContactsApi.md +4 -0
  20. data/docs/CreditNote.md +8 -2
  21. data/docs/CreditNoteLineItem.md +6 -0
  22. data/docs/CreditNotesApi.md +2 -2
  23. data/docs/EndUserDetailsRequest.md +1 -1
  24. data/docs/EventTypeEnum.md +15 -0
  25. data/docs/Expense.md +10 -2
  26. data/docs/ExpenseLine.md +8 -0
  27. data/docs/ExpenseLineRequest.md +2 -0
  28. data/docs/ExpenseRequest.md +7 -1
  29. data/docs/IncomeStatement.md +3 -1
  30. data/docs/Invoice.md +11 -1
  31. data/docs/InvoiceLineItem.md +5 -1
  32. data/docs/InvoiceRequest.md +4 -0
  33. data/docs/InvoiceStatusEnum.md +15 -0
  34. data/docs/InvoicesApi.md +2 -2
  35. data/docs/Issue.md +1 -1
  36. data/docs/Item.md +3 -1
  37. data/docs/JournalEntriesApi.md +2 -2
  38. data/docs/JournalEntry.md +9 -1
  39. data/docs/JournalEntryRequest.md +4 -0
  40. data/docs/JournalLine.md +10 -0
  41. data/docs/JournalLineRequest.md +4 -0
  42. data/docs/LinkedAccountsApi.md +2 -2
  43. data/docs/MetaResponse.md +2 -2
  44. data/docs/PaginatedAccountingPeriodList.md +22 -0
  45. data/docs/PaginatedAuditLogEventList.md +22 -0
  46. data/docs/Payment.md +7 -1
  47. data/docs/PaymentLineItem.md +32 -0
  48. data/docs/PaymentLineItemRequest.md +30 -0
  49. data/docs/PaymentRequest.md +4 -0
  50. data/docs/PurchaseOrder.md +9 -3
  51. data/docs/PurchaseOrderLineItem.md +6 -0
  52. data/docs/PurchaseOrderRequest.md +2 -0
  53. data/docs/PurchaseOrdersApi.md +2 -2
  54. data/docs/ReportItem.md +2 -0
  55. data/docs/RoleEnum.md +15 -0
  56. data/docs/SyncStatusApi.md +1 -1
  57. data/docs/TaxRate.md +3 -1
  58. data/docs/TrackingCategory.md +3 -1
  59. data/docs/Transaction.md +7 -3
  60. data/docs/TransactionLineItem.md +6 -0
  61. data/docs/VendorCredit.md +6 -2
  62. data/docs/VendorCreditLine.md +6 -0
  63. data/docs/VendorCreditsApi.md +2 -2
  64. data/lib/merge_accounting_client/api/accounting_periods_api.rb +167 -0
  65. data/lib/merge_accounting_client/api/audit_trail_api.rb +95 -0
  66. data/lib/merge_accounting_client/api/contacts_api.rb +6 -0
  67. data/lib/merge_accounting_client/api/credit_notes_api.rb +2 -2
  68. data/lib/merge_accounting_client/api/expenses_api.rb +2 -2
  69. data/lib/merge_accounting_client/api/invoices_api.rb +2 -2
  70. data/lib/merge_accounting_client/api/journal_entries_api.rb +2 -2
  71. data/lib/merge_accounting_client/api/linked_accounts_api.rb +3 -3
  72. data/lib/merge_accounting_client/api/payments_api.rb +2 -2
  73. data/lib/merge_accounting_client/api/purchase_orders_api.rb +2 -2
  74. data/lib/merge_accounting_client/api/sync_status_api.rb +2 -2
  75. data/lib/merge_accounting_client/api/transactions_api.rb +2 -2
  76. data/lib/merge_accounting_client/api/vendor_credits_api.rb +2 -2
  77. data/lib/merge_accounting_client/configuration.rb +4 -0
  78. data/lib/merge_accounting_client/models/account.rb +12 -3
  79. data/lib/merge_accounting_client/models/account_integration.rb +15 -4
  80. data/lib/merge_accounting_client/models/account_request.rb +1 -1
  81. data/lib/merge_accounting_client/models/accounting_attachment.rb +11 -2
  82. data/lib/merge_accounting_client/models/accounting_period.rb +296 -0
  83. data/lib/merge_accounting_client/models/accounting_period_status_enum.rb +45 -0
  84. data/lib/merge_accounting_client/models/accounting_phone_number.rb +10 -1
  85. data/lib/merge_accounting_client/models/address.rb +10 -1
  86. data/lib/merge_accounting_client/models/address_request.rb +311 -0
  87. data/lib/merge_accounting_client/models/audit_log_event.rb +356 -0
  88. data/lib/merge_accounting_client/models/balance_sheet.rb +11 -2
  89. data/lib/merge_accounting_client/models/cash_flow_statement.rb +11 -2
  90. data/lib/merge_accounting_client/models/company_info.rb +12 -3
  91. data/lib/merge_accounting_client/models/contact.rb +13 -4
  92. data/lib/merge_accounting_client/models/contact_request.rb +2 -2
  93. data/lib/merge_accounting_client/models/credit_note.rb +35 -3
  94. data/lib/merge_accounting_client/models/credit_note_line_item.rb +29 -1
  95. data/lib/merge_accounting_client/models/end_user_details_request.rb +1 -1
  96. data/lib/merge_accounting_client/models/event_type_enum.rb +67 -0
  97. data/lib/merge_accounting_client/models/expense.rb +45 -3
  98. data/lib/merge_accounting_client/models/expense_line.rb +40 -1
  99. data/lib/merge_accounting_client/models/expense_line_request.rb +12 -1
  100. data/lib/merge_accounting_client/models/expense_request.rb +35 -2
  101. data/lib/merge_accounting_client/models/income_statement.rb +11 -2
  102. data/lib/merge_accounting_client/models/invoice.rb +55 -1
  103. data/lib/merge_accounting_client/models/invoice_line_item.rb +20 -1
  104. data/lib/merge_accounting_client/models/invoice_request.rb +23 -1
  105. data/lib/merge_accounting_client/models/invoice_status_enum.rb +49 -0
  106. data/lib/merge_accounting_client/models/item.rb +11 -2
  107. data/lib/merge_accounting_client/models/journal_entry.rb +60 -2
  108. data/lib/merge_accounting_client/models/journal_entry_request.rb +38 -1
  109. data/lib/merge_accounting_client/models/journal_line.rb +51 -1
  110. data/lib/merge_accounting_client/models/journal_line_request.rb +23 -1
  111. data/lib/merge_accounting_client/models/paginated_accounting_period_list.rb +240 -0
  112. data/lib/merge_accounting_client/models/paginated_audit_log_event_list.rb +240 -0
  113. data/lib/merge_accounting_client/models/payment.rb +34 -2
  114. data/lib/merge_accounting_client/models/payment_line_item.rb +308 -0
  115. data/lib/merge_accounting_client/models/payment_line_item_request.rb +319 -0
  116. data/lib/merge_accounting_client/models/payment_request.rb +24 -1
  117. data/lib/merge_accounting_client/models/purchase_order.rb +49 -3
  118. data/lib/merge_accounting_client/models/purchase_order_line_item.rb +29 -1
  119. data/lib/merge_accounting_client/models/purchase_order_request.rb +12 -1
  120. data/lib/merge_accounting_client/models/report_item.rb +10 -1
  121. data/lib/merge_accounting_client/models/role_enum.rb +49 -0
  122. data/lib/merge_accounting_client/models/tax_rate.rb +11 -2
  123. data/lib/merge_accounting_client/models/tracking_category.rb +12 -3
  124. data/lib/merge_accounting_client/models/transaction.rb +23 -3
  125. data/lib/merge_accounting_client/models/transaction_line_item.rb +29 -1
  126. data/lib/merge_accounting_client/models/vendor_credit.rb +23 -3
  127. data/lib/merge_accounting_client/models/vendor_credit_line.rb +29 -1
  128. data/lib/merge_accounting_client/version.rb +1 -1
  129. data/lib/merge_accounting_client.rb +13 -9
  130. data/spec/api/accounting_periods_api_spec.rb +63 -0
  131. data/spec/api/audit_trail_api_spec.rb +51 -0
  132. data/spec/api/contacts_api_spec.rb +2 -0
  133. data/spec/api/linked_accounts_api_spec.rb +1 -1
  134. data/spec/api/sync_status_api_spec.rb +1 -1
  135. data/spec/models/account_integration_spec.rb +6 -0
  136. data/spec/models/account_spec.rb +6 -0
  137. data/spec/models/accounting_attachment_spec.rb +6 -0
  138. data/spec/models/accounting_period_spec.rb +70 -0
  139. data/spec/models/accounting_period_status_enum_spec.rb +28 -0
  140. data/spec/models/accounting_phone_number_spec.rb +6 -0
  141. data/spec/models/address_request_spec.rb +82 -0
  142. data/spec/models/address_spec.rb +6 -0
  143. data/spec/models/audit_log_event_spec.rb +76 -0
  144. data/spec/models/balance_sheet_spec.rb +6 -0
  145. data/spec/models/cash_flow_statement_spec.rb +6 -0
  146. data/spec/models/company_info_spec.rb +6 -0
  147. data/spec/models/contact_spec.rb +6 -0
  148. data/spec/models/credit_note_line_item_spec.rb +18 -0
  149. data/spec/models/credit_note_spec.rb +18 -0
  150. data/spec/models/event_type_enum_spec.rb +28 -0
  151. data/spec/models/expense_line_request_spec.rb +6 -0
  152. data/spec/models/expense_line_spec.rb +24 -0
  153. data/spec/models/expense_request_spec.rb +18 -0
  154. data/spec/models/expense_spec.rb +24 -0
  155. data/spec/models/income_statement_spec.rb +6 -0
  156. data/spec/models/invoice_line_item_spec.rb +12 -0
  157. data/spec/models/invoice_request_spec.rb +12 -0
  158. data/spec/models/invoice_spec.rb +30 -0
  159. data/spec/models/invoice_status_enum_spec.rb +28 -0
  160. data/spec/models/item_spec.rb +6 -0
  161. data/spec/models/journal_entry_request_spec.rb +12 -0
  162. data/spec/models/journal_entry_spec.rb +24 -0
  163. data/spec/models/journal_line_request_spec.rb +12 -0
  164. data/spec/models/journal_line_spec.rb +30 -0
  165. data/spec/models/paginated_accounting_period_list_spec.rb +46 -0
  166. data/spec/models/paginated_audit_log_event_list_spec.rb +46 -0
  167. data/spec/models/payment_line_item_request_spec.rb +70 -0
  168. data/spec/models/payment_line_item_spec.rb +76 -0
  169. data/spec/models/payment_request_spec.rb +12 -0
  170. data/spec/models/payment_spec.rb +18 -0
  171. data/spec/models/purchase_order_line_item_spec.rb +18 -0
  172. data/spec/models/purchase_order_request_spec.rb +6 -0
  173. data/spec/models/purchase_order_spec.rb +18 -0
  174. data/spec/models/report_item_spec.rb +6 -0
  175. data/spec/models/role_enum_spec.rb +28 -0
  176. data/spec/models/tax_rate_spec.rb +6 -0
  177. data/spec/models/tracking_category_spec.rb +6 -0
  178. data/spec/models/transaction_line_item_spec.rb +18 -0
  179. data/spec/models/transaction_spec.rb +12 -0
  180. data/spec/models/vendor_credit_line_spec.rb +18 -0
  181. data/spec/models/vendor_credit_spec.rb +12 -0
  182. metadata +204 -152
@@ -0,0 +1,240 @@
1
+ =begin
2
+ #Merge Accounting API
3
+
4
+ #The unified API for building rich integrations with multiple Accounting & Finance platforms.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: hello@merge.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MergeAccountingClient
17
+ class PaginatedAuditLogEventList
18
+ attr_accessor :_next
19
+
20
+ attr_accessor :previous
21
+
22
+ attr_accessor :results
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'_next' => :'next',
28
+ :'previous' => :'previous',
29
+ :'results' => :'results'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'_next' => :'String',
42
+ :'previous' => :'String',
43
+ :'results' => :'Array<AuditLogEvent>'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ :'_next',
51
+ :'previous',
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MergeAccountingClient::PaginatedAuditLogEventList` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MergeAccountingClient::PaginatedAuditLogEventList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'_next')
71
+ self._next = attributes[:'_next']
72
+ end
73
+
74
+ if attributes.key?(:'previous')
75
+ self.previous = attributes[:'previous']
76
+ end
77
+
78
+ if attributes.key?(:'results')
79
+ if (value = attributes[:'results']).is_a?(Array)
80
+ self.results = value
81
+ end
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ invalid_properties
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ def valid?
95
+ true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ _next == o._next &&
104
+ previous == o.previous &&
105
+ results == o.results
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [_next, previous, results].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ new.build_from_hash(attributes)
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ self.class.openapi_types.each_pair do |key, type|
133
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
134
+ self.send("#{key}=", nil)
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :Time
156
+ Time.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :Boolean
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ # models (e.g. Pet) or oneOf
187
+ klass = MergeAccountingClient.const_get(type)
188
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ if value.nil?
211
+ is_nullable = self.class.openapi_nullable.include?(attr)
212
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
213
+ end
214
+
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map { |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+
238
+ end
239
+
240
+ end
@@ -47,9 +47,17 @@ module MergeAccountingClient
47
47
  # When the third party's payment entry was updated.
48
48
  attr_accessor :remote_updated_at
49
49
 
50
- # Indicates whether or not this object has been deleted by third party webhooks.
50
+ # Indicates whether or not this object has been deleted in the third party platform.
51
51
  attr_accessor :remote_was_deleted
52
52
 
53
+ # The accounting period that the Payment was generated in.
54
+ attr_accessor :accounting_period
55
+
56
+ # A list of “Payment Applied to Lines” objects.
57
+ attr_accessor :applied_to_lines
58
+
59
+ attr_accessor :created_at
60
+
53
61
  # This is the datetime that this object was last updated by Merge
54
62
  attr_accessor :modified_at
55
63
 
@@ -72,6 +80,9 @@ module MergeAccountingClient
72
80
  :'tracking_categories' => :'tracking_categories',
73
81
  :'remote_updated_at' => :'remote_updated_at',
74
82
  :'remote_was_deleted' => :'remote_was_deleted',
83
+ :'accounting_period' => :'accounting_period',
84
+ :'applied_to_lines' => :'applied_to_lines',
85
+ :'created_at' => :'created_at',
75
86
  :'modified_at' => :'modified_at',
76
87
  :'field_mappings' => :'field_mappings',
77
88
  :'remote_data' => :'remote_data'
@@ -98,6 +109,9 @@ module MergeAccountingClient
98
109
  :'tracking_categories' => :'Array<String>',
99
110
  :'remote_updated_at' => :'Time',
100
111
  :'remote_was_deleted' => :'Boolean',
112
+ :'accounting_period' => :'String',
113
+ :'applied_to_lines' => :'Array<PaymentLineItem>',
114
+ :'created_at' => :'Time',
101
115
  :'modified_at' => :'Time',
102
116
  :'field_mappings' => :'Hash<String, Object>',
103
117
  :'remote_data' => :'Array<RemoteData>'
@@ -116,6 +130,7 @@ module MergeAccountingClient
116
130
  :'company',
117
131
  :'total_amount',
118
132
  :'remote_updated_at',
133
+ :'accounting_period',
119
134
  :'field_mappings',
120
135
  :'remote_data'
121
136
  ])
@@ -186,6 +201,20 @@ module MergeAccountingClient
186
201
  self.remote_was_deleted = attributes[:'remote_was_deleted']
187
202
  end
188
203
 
204
+ if attributes.key?(:'accounting_period')
205
+ self.accounting_period = attributes[:'accounting_period']
206
+ end
207
+
208
+ if attributes.key?(:'applied_to_lines')
209
+ if (value = attributes[:'applied_to_lines']).is_a?(Array)
210
+ self.applied_to_lines = value
211
+ end
212
+ end
213
+
214
+ if attributes.key?(:'created_at')
215
+ self.created_at = attributes[:'created_at']
216
+ end
217
+
189
218
  if attributes.key?(:'modified_at')
190
219
  self.modified_at = attributes[:'modified_at']
191
220
  end
@@ -250,6 +279,9 @@ module MergeAccountingClient
250
279
  tracking_categories == o.tracking_categories &&
251
280
  remote_updated_at == o.remote_updated_at &&
252
281
  remote_was_deleted == o.remote_was_deleted &&
282
+ accounting_period == o.accounting_period &&
283
+ applied_to_lines == o.applied_to_lines &&
284
+ created_at == o.created_at &&
253
285
  modified_at == o.modified_at &&
254
286
  field_mappings == o.field_mappings &&
255
287
  remote_data == o.remote_data
@@ -264,7 +296,7 @@ module MergeAccountingClient
264
296
  # Calculates hash code according to all attributes.
265
297
  # @return [Integer] Hash code
266
298
  def hash
267
- [id, remote_id, transaction_date, contact, account, currency, exchange_rate, company, total_amount, tracking_categories, remote_updated_at, remote_was_deleted, modified_at, field_mappings, remote_data].hash
299
+ [id, remote_id, transaction_date, contact, account, currency, exchange_rate, company, total_amount, tracking_categories, remote_updated_at, remote_was_deleted, accounting_period, applied_to_lines, created_at, modified_at, field_mappings, remote_data].hash
268
300
  end
269
301
 
270
302
  # Builds the object from hash
@@ -0,0 +1,308 @@
1
+ =begin
2
+ #Merge Accounting API
3
+
4
+ #The unified API for building rich integrations with multiple Accounting & Finance platforms.
5
+
6
+ The version of the OpenAPI document: 1.0
7
+ Contact: hello@merge.dev
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.1.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MergeAccountingClient
17
+ # # The PaymentLineItem Object ### Description The `PaymentLineItem` object is an applied-to-line on a `Payment` that can either be a `Invoice`, `CreditNote`, or `JournalEntry`. ### Usage Example `Payment` will have a field called `applied-to-lines` which will be an array of `PaymentLineItemInternalMappingSerializer` objects that can either be a `Invoice`, `CreditNote`, or `JournalEntry`.
18
+ class PaymentLineItem
19
+ # The amount being applied to the transaction.
20
+ attr_accessor :applied_amount
21
+
22
+ # The date the payment portion is applied.
23
+ attr_accessor :applied_date
24
+
25
+ # The third-party API ID of the matching object.
26
+ attr_accessor :remote_id
27
+
28
+ # The Merge ID of the transaction the payment portion is being applied to.
29
+ attr_accessor :related_object_id
30
+
31
+ # The type of transaction the payment portion is being applied to. Possible values include: INVOICE, JOURNAL_ENTRY, or CREDIT_NOTE.
32
+ attr_accessor :related_object_type
33
+
34
+ attr_accessor :id
35
+
36
+ attr_accessor :created_at
37
+
38
+ # This is the datetime that this object was last updated by Merge
39
+ attr_accessor :modified_at
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'applied_amount' => :'applied_amount',
45
+ :'applied_date' => :'applied_date',
46
+ :'remote_id' => :'remote_id',
47
+ :'related_object_id' => :'related_object_id',
48
+ :'related_object_type' => :'related_object_type',
49
+ :'id' => :'id',
50
+ :'created_at' => :'created_at',
51
+ :'modified_at' => :'modified_at'
52
+ }
53
+ end
54
+
55
+ # Returns all the JSON keys this model knows about
56
+ def self.acceptable_attributes
57
+ attribute_map.values
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.openapi_types
62
+ {
63
+ :'applied_amount' => :'String',
64
+ :'applied_date' => :'Time',
65
+ :'remote_id' => :'String',
66
+ :'related_object_id' => :'String',
67
+ :'related_object_type' => :'String',
68
+ :'id' => :'String',
69
+ :'created_at' => :'Time',
70
+ :'modified_at' => :'Time'
71
+ }
72
+ end
73
+
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ :'applied_amount',
78
+ :'applied_date',
79
+ :'remote_id',
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MergeAccountingClient::PaymentLineItem` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!self.class.attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MergeAccountingClient::PaymentLineItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'applied_amount')
99
+ self.applied_amount = attributes[:'applied_amount']
100
+ end
101
+
102
+ if attributes.key?(:'applied_date')
103
+ self.applied_date = attributes[:'applied_date']
104
+ end
105
+
106
+ if attributes.key?(:'remote_id')
107
+ self.remote_id = attributes[:'remote_id']
108
+ end
109
+
110
+ if attributes.key?(:'related_object_id')
111
+ self.related_object_id = attributes[:'related_object_id']
112
+ end
113
+
114
+ if attributes.key?(:'related_object_type')
115
+ self.related_object_type = attributes[:'related_object_type']
116
+ end
117
+
118
+ if attributes.key?(:'id')
119
+ self.id = attributes[:'id']
120
+ end
121
+
122
+ if attributes.key?(:'created_at')
123
+ self.created_at = attributes[:'created_at']
124
+ end
125
+
126
+ if attributes.key?(:'modified_at')
127
+ self.modified_at = attributes[:'modified_at']
128
+ end
129
+ end
130
+
131
+ # Show invalid properties with the reasons. Usually used together with valid?
132
+ # @return Array for valid properties with the reasons
133
+ def list_invalid_properties
134
+ invalid_properties = Array.new
135
+ pattern = Regexp.new(/^-?\d{0,32}(?:\.\d{0,16})?$/)
136
+ if !@applied_amount.nil? && @applied_amount.to_s !~ pattern
137
+ invalid_properties.push("invalid value for \"applied_amount\", must conform to the pattern #{pattern}.")
138
+ end
139
+
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ return false if !@applied_amount.nil? && @applied_amount.to_s !~ Regexp.new(/^-?\d{0,32}(?:\.\d{0,16})?$/)
147
+ true
148
+ end
149
+
150
+ # Custom attribute writer method with validation
151
+ # @param [Object] applied_amount Value to be assigned
152
+ def applied_amount=(applied_amount)
153
+ pattern = Regexp.new(/^-?\d{0,32}(?:\.\d{0,16})?$/)
154
+ if !applied_amount.nil? && applied_amount.to_s !~ pattern
155
+ fail ArgumentError, "invalid value for \"applied_amount\", must conform to the pattern #{pattern}."
156
+ end
157
+
158
+ @applied_amount = applied_amount
159
+ end
160
+
161
+ # Checks equality by comparing each attribute.
162
+ # @param [Object] Object to be compared
163
+ def ==(o)
164
+ return true if self.equal?(o)
165
+ self.class == o.class &&
166
+ applied_amount == o.applied_amount &&
167
+ applied_date == o.applied_date &&
168
+ remote_id == o.remote_id &&
169
+ related_object_id == o.related_object_id &&
170
+ related_object_type == o.related_object_type &&
171
+ id == o.id &&
172
+ created_at == o.created_at &&
173
+ modified_at == o.modified_at
174
+ end
175
+
176
+ # @see the `==` method
177
+ # @param [Object] Object to be compared
178
+ def eql?(o)
179
+ self == o
180
+ end
181
+
182
+ # Calculates hash code according to all attributes.
183
+ # @return [Integer] Hash code
184
+ def hash
185
+ [applied_amount, applied_date, remote_id, related_object_id, related_object_type, id, created_at, modified_at].hash
186
+ end
187
+
188
+ # Builds the object from hash
189
+ # @param [Hash] attributes Model attributes in the form of hash
190
+ # @return [Object] Returns the model itself
191
+ def self.build_from_hash(attributes)
192
+ new.build_from_hash(attributes)
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def build_from_hash(attributes)
199
+ return nil unless attributes.is_a?(Hash)
200
+ self.class.openapi_types.each_pair do |key, type|
201
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
202
+ self.send("#{key}=", nil)
203
+ elsif type =~ /\AArray<(.*)>/i
204
+ # check to ensure the input is an array given that the attribute
205
+ # is documented as an array but the input is not
206
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
207
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
208
+ end
209
+ elsif !attributes[self.class.attribute_map[key]].nil?
210
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
211
+ end
212
+ end
213
+
214
+ self
215
+ end
216
+
217
+ # Deserializes the data based on type
218
+ # @param string type Data type
219
+ # @param string value Value to be deserialized
220
+ # @return [Object] Deserialized data
221
+ def _deserialize(type, value)
222
+ case type.to_sym
223
+ when :Time
224
+ Time.parse(value)
225
+ when :Date
226
+ Date.parse(value)
227
+ when :String
228
+ value
229
+ when :Integer
230
+ value.to_i
231
+ when :Float
232
+ value.to_f
233
+ when :Boolean
234
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
235
+ true
236
+ else
237
+ false
238
+ end
239
+ when :Object
240
+ # generic object (usually a Hash), return directly
241
+ value
242
+ when /\AArray<(?<inner_type>.+)>\z/
243
+ inner_type = Regexp.last_match[:inner_type]
244
+ value.map { |v| _deserialize(inner_type, v) }
245
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
246
+ k_type = Regexp.last_match[:k_type]
247
+ v_type = Regexp.last_match[:v_type]
248
+ {}.tap do |hash|
249
+ value.each do |k, v|
250
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
251
+ end
252
+ end
253
+ else # model
254
+ # models (e.g. Pet) or oneOf
255
+ klass = MergeAccountingClient.const_get(type)
256
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
257
+ end
258
+ end
259
+
260
+ # Returns the string representation of the object
261
+ # @return [String] String presentation of the object
262
+ def to_s
263
+ to_hash.to_s
264
+ end
265
+
266
+ # to_body is an alias to to_hash (backward compatibility)
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_body
269
+ to_hash
270
+ end
271
+
272
+ # Returns the object in the form of hash
273
+ # @return [Hash] Returns the object in the form of hash
274
+ def to_hash
275
+ hash = {}
276
+ self.class.attribute_map.each_pair do |attr, param|
277
+ value = self.send(attr)
278
+ if value.nil?
279
+ is_nullable = self.class.openapi_nullable.include?(attr)
280
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
281
+ end
282
+
283
+ hash[param] = _to_hash(value)
284
+ end
285
+ hash
286
+ end
287
+
288
+ # Outputs non-array value in the form of hash
289
+ # For object, use to_hash. Otherwise, just return the value
290
+ # @param [Object] value Any valid value
291
+ # @return [Hash] Returns the value in the form of hash
292
+ def _to_hash(value)
293
+ if value.is_a?(Array)
294
+ value.compact.map { |v| _to_hash(v) }
295
+ elsif value.is_a?(Hash)
296
+ {}.tap do |hash|
297
+ value.each { |k, v| hash[k] = _to_hash(v) }
298
+ end
299
+ elsif value.respond_to? :to_hash
300
+ value.to_hash
301
+ else
302
+ value
303
+ end
304
+ end
305
+
306
+ end
307
+
308
+ end