merge_accounting_client 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +16 -0
  3. data/README.md +10 -5
  4. data/docs/Account.md +1 -1
  5. data/docs/AccountDetails.md +3 -1
  6. data/docs/AccountDetailsAndActions.md +2 -0
  7. data/docs/AccountingAttachment.md +1 -1
  8. data/docs/AccountsApi.md +7 -3
  9. data/docs/AddressesApi.md +3 -1
  10. data/docs/AttachmentsApi.md +2 -2
  11. data/docs/BalanceSheet.md +1 -1
  12. data/docs/BalanceSheetsApi.md +2 -2
  13. data/docs/CashFlowStatement.md +1 -1
  14. data/docs/CashFlowStatementsApi.md +2 -2
  15. data/docs/CompanyInfo.md +1 -1
  16. data/docs/CompanyInfoApi.md +2 -2
  17. data/docs/Contact.md +1 -1
  18. data/docs/ContactsApi.md +7 -3
  19. data/docs/CreditNote.md +7 -1
  20. data/docs/CreditNoteLineItem.md +38 -0
  21. data/docs/CreditNotesApi.md +7 -3
  22. data/docs/DataPassthroughRequest.md +3 -1
  23. data/docs/EndUserDetailsRequest.md +9 -7
  24. data/docs/Expense.md +1 -1
  25. data/docs/ExpensesApi.md +2 -2
  26. data/docs/IncomeStatement.md +1 -1
  27. data/docs/IncomeStatementsApi.md +2 -2
  28. data/docs/InvoiceLineItem.md +0 -2
  29. data/docs/InvoicesApi.md +8 -4
  30. data/docs/Item.md +1 -1
  31. data/docs/ItemsApi.md +7 -3
  32. data/docs/JournalEntriesApi.md +2 -2
  33. data/docs/LinkToken.md +3 -1
  34. data/docs/LinkedAccountsApi.md +2 -0
  35. data/docs/PaginatedTransactionList.md +22 -0
  36. data/docs/Payment.md +1 -1
  37. data/docs/PaymentsApi.md +2 -2
  38. data/docs/PurchaseOrder.md +8 -2
  39. data/docs/PurchaseOrderLineItem.md +9 -1
  40. data/docs/PurchaseOrdersApi.md +7 -3
  41. data/docs/RemoteResponse.md +2 -0
  42. data/docs/SyncStatusApi.md +1 -1
  43. data/docs/TaxRate.md +1 -1
  44. data/docs/TaxRatesApi.md +2 -2
  45. data/docs/TrackingCategoriesApi.md +7 -3
  46. data/docs/TrackingCategory.md +1 -1
  47. data/docs/Transaction.md +40 -0
  48. data/docs/TransactionLineItem.md +34 -0
  49. data/docs/TransactionsApi.md +181 -0
  50. data/docs/VendorCredit.md +1 -1
  51. data/docs/VendorCreditsApi.md +2 -2
  52. data/lib/merge_accounting_client/api/accounts_api.rb +16 -2
  53. data/lib/merge_accounting_client/api/addresses_api.rb +7 -0
  54. data/lib/merge_accounting_client/api/attachments_api.rb +2 -2
  55. data/lib/merge_accounting_client/api/balance_sheets_api.rb +2 -2
  56. data/lib/merge_accounting_client/api/cash_flow_statements_api.rb +2 -2
  57. data/lib/merge_accounting_client/api/company_info_api.rb +2 -2
  58. data/lib/merge_accounting_client/api/contacts_api.rb +16 -2
  59. data/lib/merge_accounting_client/api/credit_notes_api.rb +16 -2
  60. data/lib/merge_accounting_client/api/expenses_api.rb +2 -2
  61. data/lib/merge_accounting_client/api/income_statements_api.rb +2 -2
  62. data/lib/merge_accounting_client/api/invoices_api.rb +17 -3
  63. data/lib/merge_accounting_client/api/items_api.rb +16 -2
  64. data/lib/merge_accounting_client/api/journal_entries_api.rb +2 -2
  65. data/lib/merge_accounting_client/api/linked_accounts_api.rb +3 -0
  66. data/lib/merge_accounting_client/api/payments_api.rb +2 -2
  67. data/lib/merge_accounting_client/api/purchase_orders_api.rb +16 -2
  68. data/lib/merge_accounting_client/api/sync_status_api.rb +2 -2
  69. data/lib/merge_accounting_client/api/tax_rates_api.rb +2 -2
  70. data/lib/merge_accounting_client/api/tracking_categories_api.rb +16 -2
  71. data/lib/merge_accounting_client/api/transactions_api.rb +196 -0
  72. data/lib/merge_accounting_client/api/vendor_credits_api.rb +2 -2
  73. data/lib/merge_accounting_client/models/account.rb +1 -1
  74. data/lib/merge_accounting_client/models/account_details.rb +15 -4
  75. data/lib/merge_accounting_client/models/account_details_and_actions.rb +12 -1
  76. data/lib/merge_accounting_client/models/account_details_and_actions_status_enum.rb +17 -7
  77. data/lib/merge_accounting_client/models/account_status_enum.rb +17 -7
  78. data/lib/merge_accounting_client/models/accounting_attachment.rb +1 -1
  79. data/lib/merge_accounting_client/models/address_type_enum.rb +17 -7
  80. data/lib/merge_accounting_client/models/balance_sheet.rb +1 -1
  81. data/lib/merge_accounting_client/models/cash_flow_statement.rb +1 -1
  82. data/lib/merge_accounting_client/models/categories_enum.rb +17 -7
  83. data/lib/merge_accounting_client/models/category_enum.rb +17 -7
  84. data/lib/merge_accounting_client/models/classification_enum.rb +17 -7
  85. data/lib/merge_accounting_client/models/company_info.rb +1 -1
  86. data/lib/merge_accounting_client/models/contact.rb +1 -1
  87. data/lib/merge_accounting_client/models/country_enum.rb +17 -7
  88. data/lib/merge_accounting_client/models/credit_note.rb +35 -2
  89. data/lib/merge_accounting_client/models/credit_note_line_item.rb +380 -0
  90. data/lib/merge_accounting_client/models/credit_note_status_enum.rb +17 -7
  91. data/lib/merge_accounting_client/models/currency_enum.rb +17 -7
  92. data/lib/merge_accounting_client/models/data_passthrough_request.rb +14 -5
  93. data/lib/merge_accounting_client/models/encoding_enum.rb +18 -7
  94. data/lib/merge_accounting_client/models/end_user_details_request.rb +28 -11
  95. data/lib/merge_accounting_client/models/expense.rb +1 -1
  96. data/lib/merge_accounting_client/models/income_statement.rb +1 -1
  97. data/lib/merge_accounting_client/models/invoice_line_item.rb +1 -13
  98. data/lib/merge_accounting_client/models/invoice_type_enum.rb +17 -7
  99. data/lib/merge_accounting_client/models/issue_status_enum.rb +17 -7
  100. data/lib/merge_accounting_client/models/item.rb +1 -1
  101. data/lib/merge_accounting_client/models/link_token.rb +13 -4
  102. data/lib/merge_accounting_client/models/method_enum.rb +17 -7
  103. data/lib/merge_accounting_client/models/paginated_transaction_list.rb +240 -0
  104. data/lib/merge_accounting_client/models/payment.rb +1 -1
  105. data/lib/merge_accounting_client/models/purchase_order.rb +35 -2
  106. data/lib/merge_accounting_client/models/purchase_order_line_item.rb +83 -5
  107. data/lib/merge_accounting_client/models/purchase_order_status_enum.rb +17 -7
  108. data/lib/merge_accounting_client/models/remote_response.rb +13 -2
  109. data/lib/merge_accounting_client/models/request_format_enum.rb +17 -7
  110. data/lib/merge_accounting_client/models/state_enum.rb +17 -7
  111. data/lib/merge_accounting_client/models/status7d1_enum.rb +17 -7
  112. data/lib/merge_accounting_client/models/sync_status_status_enum.rb +18 -7
  113. data/lib/merge_accounting_client/models/tax_rate.rb +1 -1
  114. data/lib/merge_accounting_client/models/tracking_category.rb +1 -1
  115. data/lib/merge_accounting_client/models/transaction.rb +356 -0
  116. data/lib/merge_accounting_client/models/transaction_line_item.rb +358 -0
  117. data/lib/merge_accounting_client/models/vendor_credit.rb +1 -1
  118. data/lib/merge_accounting_client/version.rb +1 -1
  119. data/lib/merge_accounting_client.rb +5 -1
  120. data/merge_accounting_client.gemspec +1 -1
  121. data/spec/api/accounts_api_spec.rb +3 -1
  122. data/spec/api/addresses_api_spec.rb +1 -0
  123. data/spec/api/attachments_api_spec.rb +1 -1
  124. data/spec/api/balance_sheets_api_spec.rb +1 -1
  125. data/spec/api/cash_flow_statements_api_spec.rb +1 -1
  126. data/spec/api/company_info_api_spec.rb +1 -1
  127. data/spec/api/contacts_api_spec.rb +3 -1
  128. data/spec/api/credit_notes_api_spec.rb +3 -1
  129. data/spec/api/expenses_api_spec.rb +1 -1
  130. data/spec/api/income_statements_api_spec.rb +1 -1
  131. data/spec/api/invoices_api_spec.rb +3 -1
  132. data/spec/api/items_api_spec.rb +3 -1
  133. data/spec/api/journal_entries_api_spec.rb +1 -1
  134. data/spec/api/linked_accounts_api_spec.rb +1 -0
  135. data/spec/api/payments_api_spec.rb +1 -1
  136. data/spec/api/purchase_orders_api_spec.rb +3 -1
  137. data/spec/api/sync_status_api_spec.rb +1 -1
  138. data/spec/api/tax_rates_api_spec.rb +1 -1
  139. data/spec/api/tracking_categories_api_spec.rb +3 -1
  140. data/spec/api/transactions_api_spec.rb +70 -0
  141. data/spec/api/vendor_credits_api_spec.rb +1 -1
  142. data/spec/models/account_details_and_actions_spec.rb +6 -0
  143. data/spec/models/account_details_spec.rb +6 -0
  144. data/spec/models/credit_note_line_item_spec.rb +94 -0
  145. data/spec/models/credit_note_spec.rb +18 -0
  146. data/spec/models/data_passthrough_request_spec.rb +6 -0
  147. data/spec/models/end_user_details_request_spec.rb +6 -0
  148. data/spec/models/invoice_line_item_spec.rb +0 -6
  149. data/spec/models/link_token_spec.rb +6 -0
  150. data/spec/models/paginated_transaction_list_spec.rb +46 -0
  151. data/spec/models/purchase_order_line_item_spec.rb +24 -0
  152. data/spec/models/purchase_order_spec.rb +18 -0
  153. data/spec/models/remote_response_spec.rb +6 -0
  154. data/spec/models/transaction_line_item_spec.rb +82 -0
  155. data/spec/models/transaction_spec.rb +100 -0
  156. metadata +132 -111
@@ -44,7 +44,7 @@ module MergeAccountingClient
44
44
 
45
45
  attr_accessor :lines
46
46
 
47
- # Indicates whether or not this object has been deleted on the third-party.
47
+ # Indicates whether or not this object has been deleted by third party webhooks.
48
48
  attr_accessor :remote_was_deleted
49
49
 
50
50
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -49,7 +49,7 @@ module MergeAccountingClient
49
49
  # The income statement's net income.
50
50
  attr_accessor :net_income
51
51
 
52
- # Indicates whether or not this object has been deleted on the third-party.
52
+ # Indicates whether or not this object has been deleted by third party webhooks.
53
53
  attr_accessor :remote_was_deleted
54
54
 
55
55
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -21,8 +21,6 @@ module MergeAccountingClient
21
21
  # The third-party API ID of the matching object.
22
22
  attr_accessor :remote_id
23
23
 
24
- attr_accessor :remote_data
25
-
26
24
  # The line item's description.
27
25
  attr_accessor :description
28
26
 
@@ -46,7 +44,6 @@ module MergeAccountingClient
46
44
  {
47
45
  :'id' => :'id',
48
46
  :'remote_id' => :'remote_id',
49
- :'remote_data' => :'remote_data',
50
47
  :'description' => :'description',
51
48
  :'unit_price' => :'unit_price',
52
49
  :'quantity' => :'quantity',
@@ -67,7 +64,6 @@ module MergeAccountingClient
67
64
  {
68
65
  :'id' => :'String',
69
66
  :'remote_id' => :'String',
70
- :'remote_data' => :'Array<RemoteData>',
71
67
  :'description' => :'String',
72
68
  :'unit_price' => :'Float',
73
69
  :'quantity' => :'Float',
@@ -82,7 +78,6 @@ module MergeAccountingClient
82
78
  def self.openapi_nullable
83
79
  Set.new([
84
80
  :'remote_id',
85
- :'remote_data',
86
81
  :'description',
87
82
  :'unit_price',
88
83
  :'quantity',
@@ -116,12 +111,6 @@ module MergeAccountingClient
116
111
  self.remote_id = attributes[:'remote_id']
117
112
  end
118
113
 
119
- if attributes.key?(:'remote_data')
120
- if (value = attributes[:'remote_data']).is_a?(Array)
121
- self.remote_data = value
122
- end
123
- end
124
-
125
114
  if attributes.key?(:'description')
126
115
  self.description = attributes[:'description']
127
116
  end
@@ -171,7 +160,6 @@ module MergeAccountingClient
171
160
  self.class == o.class &&
172
161
  id == o.id &&
173
162
  remote_id == o.remote_id &&
174
- remote_data == o.remote_data &&
175
163
  description == o.description &&
176
164
  unit_price == o.unit_price &&
177
165
  quantity == o.quantity &&
@@ -190,7 +178,7 @@ module MergeAccountingClient
190
178
  # Calculates hash code according to all attributes.
191
179
  # @return [Integer] Hash code
192
180
  def hash
193
- [id, remote_id, remote_data, description, unit_price, quantity, total_amount, item, account, tracking_category].hash
181
+ [id, remote_id, description, unit_price, quantity, total_amount, item, account, tracking_category].hash
194
182
  end
195
183
 
196
184
  # Builds the object from hash
@@ -18,18 +18,28 @@ module MergeAccountingClient
18
18
  RECEIVABLE = "ACCOUNTS_RECEIVABLE".freeze
19
19
  PAYABLE = "ACCOUNTS_PAYABLE".freeze
20
20
 
21
- # Builds the enum from string
22
- # @param [String] The enum value in the form of the string
23
- # @return [String] The enum value
24
- def self.build_from_hash(value)
25
- new.build_from_hash(value)
26
- end
21
+ MERGE_NONSTANDARD_VALUE = "MERGE_NONSTANDARD_VALUE".freeze
22
+
23
+ attr_accessor :value
24
+ attr_accessor :raw_value
27
25
 
28
26
  # Builds the enum from string
29
27
  # @param [String] The enum value in the form of the string
30
28
  # @return [String] The enum value
31
29
  def build_from_hash(value)
32
- value
30
+ @raw_value = value
31
+ if ["ACCOUNTS_RECEIVABLE", "ACCOUNTS_PAYABLE", ].include? value
32
+ @value = value
33
+ else
34
+ @value = MERGE_NONSTANDARD_VALUE
35
+ end
36
+
37
+ self
38
+ end
39
+
40
+ def self.build_from_hash(value)
41
+ IssueStatusEnum.new.build_from_hash(value)
33
42
  end
34
43
  end
44
+
35
45
  end
@@ -18,18 +18,28 @@ module MergeAccountingClient
18
18
  ONGOING = "ONGOING".freeze
19
19
  RESOLVED = "RESOLVED".freeze
20
20
 
21
- # Builds the enum from string
22
- # @param [String] The enum value in the form of the string
23
- # @return [String] The enum value
24
- def self.build_from_hash(value)
25
- new.build_from_hash(value)
26
- end
21
+ MERGE_NONSTANDARD_VALUE = "MERGE_NONSTANDARD_VALUE".freeze
22
+
23
+ attr_accessor :value
24
+ attr_accessor :raw_value
27
25
 
28
26
  # Builds the enum from string
29
27
  # @param [String] The enum value in the form of the string
30
28
  # @return [String] The enum value
31
29
  def build_from_hash(value)
32
- value
30
+ @raw_value = value
31
+ if ["ONGOING", "RESOLVED", ].include? value
32
+ @value = value
33
+ else
34
+ @value = MERGE_NONSTANDARD_VALUE
35
+ end
36
+
37
+ self
38
+ end
39
+
40
+ def self.build_from_hash(value)
41
+ IssueStatusEnum.new.build_from_hash(value)
33
42
  end
34
43
  end
44
+
35
45
  end
@@ -42,7 +42,7 @@ module MergeAccountingClient
42
42
  # When the third party's item note was updated.
43
43
  attr_accessor :remote_updated_at
44
44
 
45
- # Indicates whether or not this object has been deleted on the third-party.
45
+ # Indicates whether or not this object has been deleted by third party webhooks.
46
46
  attr_accessor :remote_was_deleted
47
47
 
48
48
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -19,11 +19,14 @@ module MergeAccountingClient
19
19
 
20
20
  attr_accessor :integration_name
21
21
 
22
+ attr_accessor :magic_link_url
23
+
22
24
  # Attribute mapping from ruby-style variable name to JSON key.
23
25
  def self.attribute_map
24
26
  {
25
27
  :'link_token' => :'link_token',
26
- :'integration_name' => :'integration_name'
28
+ :'integration_name' => :'integration_name',
29
+ :'magic_link_url' => :'magic_link_url'
27
30
  }
28
31
  end
29
32
 
@@ -36,7 +39,8 @@ module MergeAccountingClient
36
39
  def self.openapi_types
37
40
  {
38
41
  :'link_token' => :'String',
39
- :'integration_name' => :'String'
42
+ :'integration_name' => :'String',
43
+ :'magic_link_url' => :'String'
40
44
  }
41
45
  end
42
46
 
@@ -68,6 +72,10 @@ module MergeAccountingClient
68
72
  if attributes.key?(:'integration_name')
69
73
  self.integration_name = attributes[:'integration_name']
70
74
  end
75
+
76
+ if attributes.key?(:'magic_link_url')
77
+ self.magic_link_url = attributes[:'magic_link_url']
78
+ end
71
79
  end
72
80
 
73
81
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -99,7 +107,8 @@ module MergeAccountingClient
99
107
  return true if self.equal?(o)
100
108
  self.class == o.class &&
101
109
  link_token == o.link_token &&
102
- integration_name == o.integration_name
110
+ integration_name == o.integration_name &&
111
+ magic_link_url == o.magic_link_url
103
112
  end
104
113
 
105
114
  # @see the `==` method
@@ -111,7 +120,7 @@ module MergeAccountingClient
111
120
  # Calculates hash code according to all attributes.
112
121
  # @return [Integer] Hash code
113
122
  def hash
114
- [link_token, integration_name].hash
123
+ [link_token, integration_name, magic_link_url].hash
115
124
  end
116
125
 
117
126
  # Builds the object from hash
@@ -23,18 +23,28 @@ module MergeAccountingClient
23
23
  PATCH = "PATCH".freeze
24
24
  DELETE = "DELETE".freeze
25
25
 
26
- # Builds the enum from string
27
- # @param [String] The enum value in the form of the string
28
- # @return [String] The enum value
29
- def self.build_from_hash(value)
30
- new.build_from_hash(value)
31
- end
26
+ MERGE_NONSTANDARD_VALUE = "MERGE_NONSTANDARD_VALUE".freeze
27
+
28
+ attr_accessor :value
29
+ attr_accessor :raw_value
32
30
 
33
31
  # Builds the enum from string
34
32
  # @param [String] The enum value in the form of the string
35
33
  # @return [String] The enum value
36
34
  def build_from_hash(value)
37
- value
35
+ @raw_value = value
36
+ if ["GET", "OPTIONS", "HEAD", "POST", "PUT", "PATCH", "DELETE", ].include? value
37
+ @value = value
38
+ else
39
+ @value = MERGE_NONSTANDARD_VALUE
40
+ end
41
+
42
+ self
43
+ end
44
+
45
+ def self.build_from_hash(value)
46
+ IssueStatusEnum.new.build_from_hash(value)
38
47
  end
39
48
  end
49
+
40
50
  end
@@ -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 PaginatedTransactionList
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<Transaction>'
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::PaginatedTransactionList` 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::PaginatedTransactionList`. 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
@@ -36,7 +36,7 @@ module MergeAccountingClient
36
36
  # When the third party's payment entry was updated.
37
37
  attr_accessor :remote_updated_at
38
38
 
39
- # Indicates whether or not this object has been deleted on the third-party.
39
+ # Indicates whether or not this object has been deleted by third party webhooks.
40
40
  attr_accessor :remote_was_deleted
41
41
 
42
42
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -35,6 +35,15 @@ module MergeAccountingClient
35
35
  # The purchase order's delivery address.
36
36
  attr_accessor :delivery_address
37
37
 
38
+ # The purchase order's customer.
39
+ attr_accessor :customer
40
+
41
+ # The purchase_order's vendor.
42
+ attr_accessor :vendor
43
+
44
+ # A memo attached to the purchase order.
45
+ attr_accessor :memo
46
+
38
47
  # The purchase order's total amount.
39
48
  attr_accessor :total_amount
40
49
 
@@ -49,7 +58,7 @@ module MergeAccountingClient
49
58
  # When the third party's purchase order note was updated.
50
59
  attr_accessor :remote_updated_at
51
60
 
52
- # Indicates whether or not this object has been deleted on the third-party.
61
+ # Indicates whether or not this object has been deleted by third party webhooks.
53
62
  attr_accessor :remote_was_deleted
54
63
 
55
64
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -62,6 +71,9 @@ module MergeAccountingClient
62
71
  :'issue_date' => :'issue_date',
63
72
  :'delivery_date' => :'delivery_date',
64
73
  :'delivery_address' => :'delivery_address',
74
+ :'customer' => :'customer',
75
+ :'vendor' => :'vendor',
76
+ :'memo' => :'memo',
65
77
  :'total_amount' => :'total_amount',
66
78
  :'currency' => :'currency',
67
79
  :'line_items' => :'line_items',
@@ -86,6 +98,9 @@ module MergeAccountingClient
86
98
  :'issue_date' => :'Time',
87
99
  :'delivery_date' => :'Time',
88
100
  :'delivery_address' => :'String',
101
+ :'customer' => :'String',
102
+ :'vendor' => :'String',
103
+ :'memo' => :'String',
89
104
  :'total_amount' => :'Float',
90
105
  :'currency' => :'CurrencyEnum',
91
106
  :'line_items' => :'Array<PurchaseOrderLineItem>',
@@ -104,6 +119,9 @@ module MergeAccountingClient
104
119
  :'issue_date',
105
120
  :'delivery_date',
106
121
  :'delivery_address',
122
+ :'customer',
123
+ :'vendor',
124
+ :'memo',
107
125
  :'total_amount',
108
126
  :'currency',
109
127
  :'remote_created_at',
@@ -156,6 +174,18 @@ module MergeAccountingClient
156
174
  self.delivery_address = attributes[:'delivery_address']
157
175
  end
158
176
 
177
+ if attributes.key?(:'customer')
178
+ self.customer = attributes[:'customer']
179
+ end
180
+
181
+ if attributes.key?(:'vendor')
182
+ self.vendor = attributes[:'vendor']
183
+ end
184
+
185
+ if attributes.key?(:'memo')
186
+ self.memo = attributes[:'memo']
187
+ end
188
+
159
189
  if attributes.key?(:'total_amount')
160
190
  self.total_amount = attributes[:'total_amount']
161
191
  end
@@ -208,6 +238,9 @@ module MergeAccountingClient
208
238
  issue_date == o.issue_date &&
209
239
  delivery_date == o.delivery_date &&
210
240
  delivery_address == o.delivery_address &&
241
+ customer == o.customer &&
242
+ vendor == o.vendor &&
243
+ memo == o.memo &&
211
244
  total_amount == o.total_amount &&
212
245
  currency == o.currency &&
213
246
  line_items == o.line_items &&
@@ -225,7 +258,7 @@ module MergeAccountingClient
225
258
  # Calculates hash code according to all attributes.
226
259
  # @return [Integer] Hash code
227
260
  def hash
228
- [id, remote_id, remote_data, status, issue_date, delivery_date, delivery_address, total_amount, currency, line_items, remote_created_at, remote_updated_at, remote_was_deleted].hash
261
+ [id, remote_id, remote_data, status, issue_date, delivery_date, delivery_address, customer, vendor, memo, total_amount, currency, line_items, remote_created_at, remote_updated_at, remote_was_deleted].hash
229
262
  end
230
263
 
231
264
  # Builds the object from hash