merge_accounting_client 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -5
  3. data/docs/Account.md +3 -1
  4. data/docs/AccountingAttachment.md +3 -1
  5. data/docs/BalanceSheet.md +3 -1
  6. data/docs/CashFlowStatement.md +3 -1
  7. data/docs/CompanyInfo.md +3 -1
  8. data/docs/Contact.md +3 -1
  9. data/docs/CreditNote.md +3 -1
  10. data/docs/Expense.md +3 -1
  11. data/docs/ForceResyncApi.md +4 -4
  12. data/docs/IncomeStatement.md +3 -1
  13. data/docs/Invoice.md +3 -1
  14. data/docs/InvoiceLineItem.md +3 -1
  15. data/docs/InvoiceLineItemRequest.md +3 -1
  16. data/docs/Item.md +3 -1
  17. data/docs/JournalEntry.md +7 -3
  18. data/docs/JournalEntryRequest.md +3 -1
  19. data/docs/JournalLine.md +2 -0
  20. data/docs/JournalLineRequest.md +2 -0
  21. data/docs/LinkedAccountsApi.md +14 -14
  22. data/docs/PaginatedVendorCreditList.md +22 -0
  23. data/docs/Payment.md +3 -1
  24. data/docs/PurchaseOrder.md +3 -1
  25. data/docs/TaxRate.md +3 -1
  26. data/docs/TrackingCategory.md +3 -1
  27. data/docs/VendorCredit.md +36 -0
  28. data/docs/VendorCreditLine.md +26 -0
  29. data/docs/VendorCreditsApi.md +181 -0
  30. data/docs/WebhookReceiversApi.md +14 -16
  31. data/lib/merge_accounting_client/api/force_resync_api.rb +3 -3
  32. data/lib/merge_accounting_client/api/linked_accounts_api.rb +15 -15
  33. data/lib/merge_accounting_client/api/vendor_credits_api.rb +196 -0
  34. data/lib/merge_accounting_client/api/webhook_receivers_api.rb +23 -15
  35. data/lib/merge_accounting_client/models/account.rb +15 -5
  36. data/lib/merge_accounting_client/models/account_details_and_actions_status_enum.rb +0 -2
  37. data/lib/merge_accounting_client/models/account_status_enum.rb +0 -2
  38. data/lib/merge_accounting_client/models/accounting_attachment.rb +15 -5
  39. data/lib/merge_accounting_client/models/address_type_enum.rb +0 -2
  40. data/lib/merge_accounting_client/models/balance_sheet.rb +15 -5
  41. data/lib/merge_accounting_client/models/cash_flow_statement.rb +15 -5
  42. data/lib/merge_accounting_client/models/categories_enum.rb +1 -2
  43. data/lib/merge_accounting_client/models/category_enum.rb +1 -2
  44. data/lib/merge_accounting_client/models/classification_enum.rb +0 -2
  45. data/lib/merge_accounting_client/models/company_info.rb +14 -4
  46. data/lib/merge_accounting_client/models/contact.rb +14 -4
  47. data/lib/merge_accounting_client/models/country_enum.rb +0 -2
  48. data/lib/merge_accounting_client/models/credit_note.rb +14 -4
  49. data/lib/merge_accounting_client/models/credit_note_status_enum.rb +0 -2
  50. data/lib/merge_accounting_client/models/currency_enum.rb +0 -2
  51. data/lib/merge_accounting_client/models/encoding_enum.rb +0 -2
  52. data/lib/merge_accounting_client/models/expense.rb +14 -4
  53. data/lib/merge_accounting_client/models/income_statement.rb +15 -5
  54. data/lib/merge_accounting_client/models/invoice.rb +13 -4
  55. data/lib/merge_accounting_client/models/invoice_line_item.rb +15 -5
  56. data/lib/merge_accounting_client/models/invoice_line_item_request.rb +15 -5
  57. data/lib/merge_accounting_client/models/invoice_type_enum.rb +0 -2
  58. data/lib/merge_accounting_client/models/issue_status_enum.rb +0 -2
  59. data/lib/merge_accounting_client/models/item.rb +15 -5
  60. data/lib/merge_accounting_client/models/journal_entry.rb +30 -10
  61. data/lib/merge_accounting_client/models/journal_entry_request.rb +17 -6
  62. data/lib/merge_accounting_client/models/journal_line.rb +11 -1
  63. data/lib/merge_accounting_client/models/journal_line_request.rb +11 -1
  64. data/lib/merge_accounting_client/models/method_enum.rb +0 -2
  65. data/lib/merge_accounting_client/models/{paginated_webhook_receiver_list.rb → paginated_vendor_credit_list.rb} +4 -4
  66. data/lib/merge_accounting_client/models/payment.rb +15 -5
  67. data/lib/merge_accounting_client/models/purchase_order.rb +15 -5
  68. data/lib/merge_accounting_client/models/purchase_order_status_enum.rb +0 -2
  69. data/lib/merge_accounting_client/models/request_format_enum.rb +0 -2
  70. data/lib/merge_accounting_client/models/state_enum.rb +0 -2
  71. data/lib/merge_accounting_client/models/status7d1_enum.rb +0 -2
  72. data/lib/merge_accounting_client/models/sync_status_status_enum.rb +0 -2
  73. data/lib/merge_accounting_client/models/tax_rate.rb +15 -5
  74. data/lib/merge_accounting_client/models/tracking_category.rb +15 -5
  75. data/lib/merge_accounting_client/models/vendor_credit.rb +317 -0
  76. data/lib/merge_accounting_client/models/vendor_credit_line.rb +265 -0
  77. data/lib/merge_accounting_client/version.rb +1 -1
  78. data/lib/merge_accounting_client.rb +4 -1
  79. data/spec/api/force_resync_api_spec.rb +1 -1
  80. data/spec/api/linked_accounts_api_spec.rb +7 -7
  81. data/spec/api/vendor_credits_api_spec.rb +70 -0
  82. data/spec/api/webhook_receivers_api_spec.rb +3 -3
  83. data/spec/models/account_spec.rb +6 -0
  84. data/spec/models/accounting_attachment_spec.rb +6 -0
  85. data/spec/models/balance_sheet_spec.rb +6 -0
  86. data/spec/models/cash_flow_statement_spec.rb +6 -0
  87. data/spec/models/company_info_spec.rb +6 -0
  88. data/spec/models/contact_spec.rb +6 -0
  89. data/spec/models/credit_note_spec.rb +6 -0
  90. data/spec/models/expense_spec.rb +6 -0
  91. data/spec/models/income_statement_spec.rb +6 -0
  92. data/spec/models/invoice_line_item_request_spec.rb +6 -0
  93. data/spec/models/invoice_line_item_spec.rb +6 -0
  94. data/spec/models/invoice_spec.rb +6 -0
  95. data/spec/models/item_spec.rb +6 -0
  96. data/spec/models/journal_entry_request_spec.rb +6 -0
  97. data/spec/models/journal_entry_spec.rb +13 -1
  98. data/spec/models/journal_line_request_spec.rb +6 -0
  99. data/spec/models/journal_line_spec.rb +6 -0
  100. data/spec/models/{paginated_webhook_receiver_list_spec.rb → paginated_vendor_credit_list_spec.rb} +6 -6
  101. data/spec/models/payment_spec.rb +6 -0
  102. data/spec/models/purchase_order_spec.rb +6 -0
  103. data/spec/models/tax_rate_spec.rb +6 -0
  104. data/spec/models/tracking_category_spec.rb +6 -0
  105. data/spec/models/vendor_credit_line_spec.rb +58 -0
  106. data/spec/models/vendor_credit_spec.rb +88 -0
  107. metadata +118 -106
  108. data/docs/PaginatedWebhookReceiverList.md +0 -22
@@ -14,7 +14,7 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module MergeAccountingClient
17
- class PaginatedWebhookReceiverList
17
+ class PaginatedVendorCreditList
18
18
  attr_accessor :_next
19
19
 
20
20
  attr_accessor :previous
@@ -40,7 +40,7 @@ module MergeAccountingClient
40
40
  {
41
41
  :'_next' => :'String',
42
42
  :'previous' => :'String',
43
- :'results' => :'Array<WebhookReceiver>'
43
+ :'results' => :'Array<VendorCredit>'
44
44
  }
45
45
  end
46
46
 
@@ -56,13 +56,13 @@ module MergeAccountingClient
56
56
  # @param [Hash] attributes Model attributes in the form of hash
57
57
  def initialize(attributes = {})
58
58
  if (!attributes.is_a?(Hash))
59
- fail ArgumentError, "The input argument (attributes) must be a hash in `MergeAccountingClient::PaginatedWebhookReceiverList` initialize method"
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MergeAccountingClient::PaginatedVendorCreditList` initialize method"
60
60
  end
61
61
 
62
62
  # check to see if the attribute exists and convert string to symbol for hash key
63
63
  attributes = attributes.each_with_object({}) { |(k, v), h|
64
64
  if (!self.class.attribute_map.key?(k.to_sym))
65
- fail ArgumentError, "`#{k}` is not a valid attribute in `MergeAccountingClient::PaginatedWebhookReceiverList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MergeAccountingClient::PaginatedVendorCreditList`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
66
  end
67
67
  h[k.to_sym] = v
68
68
  }
@@ -36,6 +36,9 @@ 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.
40
+ attr_accessor :remote_was_deleted
41
+
39
42
  # Attribute mapping from ruby-style variable name to JSON key.
40
43
  def self.attribute_map
41
44
  {
@@ -46,7 +49,8 @@ module MergeAccountingClient
46
49
  :'contact' => :'contact',
47
50
  :'account' => :'account',
48
51
  :'total_amount' => :'total_amount',
49
- :'remote_updated_at' => :'remote_updated_at'
52
+ :'remote_updated_at' => :'remote_updated_at',
53
+ :'remote_was_deleted' => :'remote_was_deleted'
50
54
  }
51
55
  end
52
56
 
@@ -65,7 +69,8 @@ module MergeAccountingClient
65
69
  :'contact' => :'String',
66
70
  :'account' => :'String',
67
71
  :'total_amount' => :'Float',
68
- :'remote_updated_at' => :'Time'
72
+ :'remote_updated_at' => :'Time',
73
+ :'remote_was_deleted' => :'Boolean'
69
74
  }
70
75
  end
71
76
 
@@ -78,7 +83,7 @@ module MergeAccountingClient
78
83
  :'contact',
79
84
  :'account',
80
85
  :'total_amount',
81
- :'remote_updated_at'
86
+ :'remote_updated_at',
82
87
  ])
83
88
  end
84
89
 
@@ -130,6 +135,10 @@ module MergeAccountingClient
130
135
  if attributes.key?(:'remote_updated_at')
131
136
  self.remote_updated_at = attributes[:'remote_updated_at']
132
137
  end
138
+
139
+ if attributes.key?(:'remote_was_deleted')
140
+ self.remote_was_deleted = attributes[:'remote_was_deleted']
141
+ end
133
142
  end
134
143
 
135
144
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -157,7 +166,8 @@ module MergeAccountingClient
157
166
  contact == o.contact &&
158
167
  account == o.account &&
159
168
  total_amount == o.total_amount &&
160
- remote_updated_at == o.remote_updated_at
169
+ remote_updated_at == o.remote_updated_at &&
170
+ remote_was_deleted == o.remote_was_deleted
161
171
  end
162
172
 
163
173
  # @see the `==` method
@@ -169,7 +179,7 @@ module MergeAccountingClient
169
179
  # Calculates hash code according to all attributes.
170
180
  # @return [Integer] Hash code
171
181
  def hash
172
- [id, remote_id, remote_data, transaction_date, contact, account, total_amount, remote_updated_at].hash
182
+ [id, remote_id, remote_data, transaction_date, contact, account, total_amount, remote_updated_at, remote_was_deleted].hash
173
183
  end
174
184
 
175
185
  # Builds the object from hash
@@ -49,6 +49,9 @@ module MergeAccountingClient
49
49
  # When the third party's purchase order note was updated.
50
50
  attr_accessor :remote_updated_at
51
51
 
52
+ # Indicates whether or not this object has been deleted on the third-party.
53
+ attr_accessor :remote_was_deleted
54
+
52
55
  # Attribute mapping from ruby-style variable name to JSON key.
53
56
  def self.attribute_map
54
57
  {
@@ -63,7 +66,8 @@ module MergeAccountingClient
63
66
  :'currency' => :'currency',
64
67
  :'line_items' => :'line_items',
65
68
  :'remote_created_at' => :'remote_created_at',
66
- :'remote_updated_at' => :'remote_updated_at'
69
+ :'remote_updated_at' => :'remote_updated_at',
70
+ :'remote_was_deleted' => :'remote_was_deleted'
67
71
  }
68
72
  end
69
73
 
@@ -86,7 +90,8 @@ module MergeAccountingClient
86
90
  :'currency' => :'CurrencyEnum',
87
91
  :'line_items' => :'Array<PurchaseOrderLineItem>',
88
92
  :'remote_created_at' => :'Time',
89
- :'remote_updated_at' => :'Time'
93
+ :'remote_updated_at' => :'Time',
94
+ :'remote_was_deleted' => :'Boolean'
90
95
  }
91
96
  end
92
97
 
@@ -102,7 +107,7 @@ module MergeAccountingClient
102
107
  :'total_amount',
103
108
  :'currency',
104
109
  :'remote_created_at',
105
- :'remote_updated_at'
110
+ :'remote_updated_at',
106
111
  ])
107
112
  end
108
113
 
@@ -172,6 +177,10 @@ module MergeAccountingClient
172
177
  if attributes.key?(:'remote_updated_at')
173
178
  self.remote_updated_at = attributes[:'remote_updated_at']
174
179
  end
180
+
181
+ if attributes.key?(:'remote_was_deleted')
182
+ self.remote_was_deleted = attributes[:'remote_was_deleted']
183
+ end
175
184
  end
176
185
 
177
186
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -203,7 +212,8 @@ module MergeAccountingClient
203
212
  currency == o.currency &&
204
213
  line_items == o.line_items &&
205
214
  remote_created_at == o.remote_created_at &&
206
- remote_updated_at == o.remote_updated_at
215
+ remote_updated_at == o.remote_updated_at &&
216
+ remote_was_deleted == o.remote_was_deleted
207
217
  end
208
218
 
209
219
  # @see the `==` method
@@ -215,7 +225,7 @@ module MergeAccountingClient
215
225
  # Calculates hash code according to all attributes.
216
226
  # @return [Integer] Hash code
217
227
  def hash
218
- [id, remote_id, remote_data, status, issue_date, delivery_date, delivery_address, total_amount, currency, line_items, remote_created_at, remote_updated_at].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
219
229
  end
220
230
 
221
231
  # Builds the object from hash
@@ -32,8 +32,6 @@ module MergeAccountingClient
32
32
  # @param [String] The enum value in the form of the string
33
33
  # @return [String] The enum value
34
34
  def build_from_hash(value)
35
- constantValues = PurchaseOrderStatusEnum.constants.select { |c| PurchaseOrderStatusEnum::const_get(c) == value }
36
- raise "Invalid ENUM value #{value} for class #PurchaseOrderStatusEnum" if constantValues.empty?
37
35
  value
38
36
  end
39
37
  end
@@ -30,8 +30,6 @@ module MergeAccountingClient
30
30
  # @param [String] The enum value in the form of the string
31
31
  # @return [String] The enum value
32
32
  def build_from_hash(value)
33
- constantValues = RequestFormatEnum.constants.select { |c| RequestFormatEnum::const_get(c) == value }
34
- raise "Invalid ENUM value #{value} for class #RequestFormatEnum" if constantValues.empty?
35
33
  value
36
34
  end
37
35
  end
@@ -86,8 +86,6 @@ module MergeAccountingClient
86
86
  # @param [String] The enum value in the form of the string
87
87
  # @return [String] The enum value
88
88
  def build_from_hash(value)
89
- constantValues = StateEnum.constants.select { |c| StateEnum::const_get(c) == value }
90
- raise "Invalid ENUM value #{value} for class #StateEnum" if constantValues.empty?
91
89
  value
92
90
  end
93
91
  end
@@ -29,8 +29,6 @@ module MergeAccountingClient
29
29
  # @param [String] The enum value in the form of the string
30
30
  # @return [String] The enum value
31
31
  def build_from_hash(value)
32
- constantValues = Status7d1Enum.constants.select { |c| Status7d1Enum::const_get(c) == value }
33
- raise "Invalid ENUM value #{value} for class #Status7d1Enum" if constantValues.empty?
34
32
  value
35
33
  end
36
34
  end
@@ -31,8 +31,6 @@ module MergeAccountingClient
31
31
  # @param [String] The enum value in the form of the string
32
32
  # @return [String] The enum value
33
33
  def build_from_hash(value)
34
- constantValues = SyncStatusStatusEnum.constants.select { |c| SyncStatusStatusEnum::const_get(c) == value }
35
- raise "Invalid ENUM value #{value} for class #SyncStatusStatusEnum" if constantValues.empty?
36
34
  value
37
35
  end
38
36
  end
@@ -32,6 +32,9 @@ module MergeAccountingClient
32
32
  # The tax rate's effective tax rate.
33
33
  attr_accessor :effective_tax_rate
34
34
 
35
+ # Indicates whether or not this object has been deleted on the third-party.
36
+ attr_accessor :remote_was_deleted
37
+
35
38
  # Attribute mapping from ruby-style variable name to JSON key.
36
39
  def self.attribute_map
37
40
  {
@@ -40,7 +43,8 @@ module MergeAccountingClient
40
43
  :'remote_data' => :'remote_data',
41
44
  :'description' => :'description',
42
45
  :'total_tax_rate' => :'total_tax_rate',
43
- :'effective_tax_rate' => :'effective_tax_rate'
46
+ :'effective_tax_rate' => :'effective_tax_rate',
47
+ :'remote_was_deleted' => :'remote_was_deleted'
44
48
  }
45
49
  end
46
50
 
@@ -57,7 +61,8 @@ module MergeAccountingClient
57
61
  :'remote_data' => :'Array<RemoteData>',
58
62
  :'description' => :'String',
59
63
  :'total_tax_rate' => :'Float',
60
- :'effective_tax_rate' => :'Float'
64
+ :'effective_tax_rate' => :'Float',
65
+ :'remote_was_deleted' => :'Boolean'
61
66
  }
62
67
  end
63
68
 
@@ -68,7 +73,7 @@ module MergeAccountingClient
68
73
  :'remote_data',
69
74
  :'description',
70
75
  :'total_tax_rate',
71
- :'effective_tax_rate'
76
+ :'effective_tax_rate',
72
77
  ])
73
78
  end
74
79
 
@@ -112,6 +117,10 @@ module MergeAccountingClient
112
117
  if attributes.key?(:'effective_tax_rate')
113
118
  self.effective_tax_rate = attributes[:'effective_tax_rate']
114
119
  end
120
+
121
+ if attributes.key?(:'remote_was_deleted')
122
+ self.remote_was_deleted = attributes[:'remote_was_deleted']
123
+ end
115
124
  end
116
125
 
117
126
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -137,7 +146,8 @@ module MergeAccountingClient
137
146
  remote_data == o.remote_data &&
138
147
  description == o.description &&
139
148
  total_tax_rate == o.total_tax_rate &&
140
- effective_tax_rate == o.effective_tax_rate
149
+ effective_tax_rate == o.effective_tax_rate &&
150
+ remote_was_deleted == o.remote_was_deleted
141
151
  end
142
152
 
143
153
  # @see the `==` method
@@ -149,7 +159,7 @@ module MergeAccountingClient
149
159
  # Calculates hash code according to all attributes.
150
160
  # @return [Integer] Hash code
151
161
  def hash
152
- [id, remote_id, remote_data, description, total_tax_rate, effective_tax_rate].hash
162
+ [id, remote_id, remote_data, description, total_tax_rate, effective_tax_rate, remote_was_deleted].hash
153
163
  end
154
164
 
155
165
  # Builds the object from hash
@@ -29,6 +29,9 @@ module MergeAccountingClient
29
29
  # The tracking category's status.
30
30
  attr_accessor :status
31
31
 
32
+ # Indicates whether or not this object has been deleted on the third-party.
33
+ attr_accessor :remote_was_deleted
34
+
32
35
  # Attribute mapping from ruby-style variable name to JSON key.
33
36
  def self.attribute_map
34
37
  {
@@ -36,7 +39,8 @@ module MergeAccountingClient
36
39
  :'remote_id' => :'remote_id',
37
40
  :'remote_data' => :'remote_data',
38
41
  :'name' => :'name',
39
- :'status' => :'status'
42
+ :'status' => :'status',
43
+ :'remote_was_deleted' => :'remote_was_deleted'
40
44
  }
41
45
  end
42
46
 
@@ -52,7 +56,8 @@ module MergeAccountingClient
52
56
  :'remote_id' => :'String',
53
57
  :'remote_data' => :'Array<RemoteData>',
54
58
  :'name' => :'String',
55
- :'status' => :'Status7d1Enum'
59
+ :'status' => :'Status7d1Enum',
60
+ :'remote_was_deleted' => :'Boolean'
56
61
  }
57
62
  end
58
63
 
@@ -62,7 +67,7 @@ module MergeAccountingClient
62
67
  :'remote_id',
63
68
  :'remote_data',
64
69
  :'name',
65
- :'status'
70
+ :'status',
66
71
  ])
67
72
  end
68
73
 
@@ -102,6 +107,10 @@ module MergeAccountingClient
102
107
  if attributes.key?(:'status')
103
108
  self.status = attributes[:'status']
104
109
  end
110
+
111
+ if attributes.key?(:'remote_was_deleted')
112
+ self.remote_was_deleted = attributes[:'remote_was_deleted']
113
+ end
105
114
  end
106
115
 
107
116
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -126,7 +135,8 @@ module MergeAccountingClient
126
135
  remote_id == o.remote_id &&
127
136
  remote_data == o.remote_data &&
128
137
  name == o.name &&
129
- status == o.status
138
+ status == o.status &&
139
+ remote_was_deleted == o.remote_was_deleted
130
140
  end
131
141
 
132
142
  # @see the `==` method
@@ -138,7 +148,7 @@ module MergeAccountingClient
138
148
  # Calculates hash code according to all attributes.
139
149
  # @return [Integer] Hash code
140
150
  def hash
141
- [id, remote_id, remote_data, name, status].hash
151
+ [id, remote_id, remote_data, name, status, remote_was_deleted].hash
142
152
  end
143
153
 
144
154
  # Builds the object from hash
@@ -0,0 +1,317 @@
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 VendorCredit Object ### Description The `VendorCredit` object is used to represent a company's vendor credits. ### Usage Example Fetch from the `GET VendorCredit` endpoint and view a company's vendor credits.
18
+ class VendorCredit
19
+ attr_accessor :id
20
+
21
+ # The third-party API ID of the matching object.
22
+ attr_accessor :remote_id
23
+
24
+ attr_accessor :remote_data
25
+
26
+ # The vendor credit's number.
27
+ attr_accessor :number
28
+
29
+ # The vendor credit's transaction date.
30
+ attr_accessor :transaction_date
31
+
32
+ attr_accessor :vendor
33
+
34
+ # The vendor credit's total amount.
35
+ attr_accessor :total_amount
36
+
37
+ # The vendor credit's currency.
38
+ attr_accessor :currency
39
+
40
+ attr_accessor :lines
41
+
42
+ # Indicates whether or not this object has been deleted on the third-party.
43
+ attr_accessor :remote_was_deleted
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'id' => :'id',
49
+ :'remote_id' => :'remote_id',
50
+ :'remote_data' => :'remote_data',
51
+ :'number' => :'number',
52
+ :'transaction_date' => :'transaction_date',
53
+ :'vendor' => :'vendor',
54
+ :'total_amount' => :'total_amount',
55
+ :'currency' => :'currency',
56
+ :'lines' => :'lines',
57
+ :'remote_was_deleted' => :'remote_was_deleted'
58
+ }
59
+ end
60
+
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ attribute_map.values
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'id' => :'String',
70
+ :'remote_id' => :'String',
71
+ :'remote_data' => :'Array<RemoteData>',
72
+ :'number' => :'String',
73
+ :'transaction_date' => :'Time',
74
+ :'vendor' => :'String',
75
+ :'total_amount' => :'Float',
76
+ :'currency' => :'CurrencyEnum',
77
+ :'lines' => :'Array<VendorCreditLine>',
78
+ :'remote_was_deleted' => :'Boolean'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ :'remote_id',
86
+ :'remote_data',
87
+ :'number',
88
+ :'transaction_date',
89
+ :'vendor',
90
+ :'total_amount',
91
+ :'currency',
92
+ ])
93
+ end
94
+
95
+ # Initializes the object
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ def initialize(attributes = {})
98
+ if (!attributes.is_a?(Hash))
99
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MergeAccountingClient::VendorCredit` initialize method"
100
+ end
101
+
102
+ # check to see if the attribute exists and convert string to symbol for hash key
103
+ attributes = attributes.each_with_object({}) { |(k, v), h|
104
+ if (!self.class.attribute_map.key?(k.to_sym))
105
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MergeAccountingClient::VendorCredit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
106
+ end
107
+ h[k.to_sym] = v
108
+ }
109
+
110
+ if attributes.key?(:'id')
111
+ self.id = attributes[:'id']
112
+ end
113
+
114
+ if attributes.key?(:'remote_id')
115
+ self.remote_id = attributes[:'remote_id']
116
+ end
117
+
118
+ if attributes.key?(:'remote_data')
119
+ if (value = attributes[:'remote_data']).is_a?(Array)
120
+ self.remote_data = value
121
+ end
122
+ end
123
+
124
+ if attributes.key?(:'number')
125
+ self.number = attributes[:'number']
126
+ end
127
+
128
+ if attributes.key?(:'transaction_date')
129
+ self.transaction_date = attributes[:'transaction_date']
130
+ end
131
+
132
+ if attributes.key?(:'vendor')
133
+ self.vendor = attributes[:'vendor']
134
+ end
135
+
136
+ if attributes.key?(:'total_amount')
137
+ self.total_amount = attributes[:'total_amount']
138
+ end
139
+
140
+ if attributes.key?(:'currency')
141
+ self.currency = attributes[:'currency']
142
+ end
143
+
144
+ if attributes.key?(:'lines')
145
+ if (value = attributes[:'lines']).is_a?(Array)
146
+ self.lines = value
147
+ end
148
+ end
149
+
150
+ if attributes.key?(:'remote_was_deleted')
151
+ self.remote_was_deleted = attributes[:'remote_was_deleted']
152
+ end
153
+ end
154
+
155
+ # Show invalid properties with the reasons. Usually used together with valid?
156
+ # @return Array for valid properties with the reasons
157
+ def list_invalid_properties
158
+ invalid_properties = Array.new
159
+ invalid_properties
160
+ end
161
+
162
+ # Check to see if the all the properties in the model are valid
163
+ # @return true if the model is valid
164
+ def valid?
165
+ true
166
+ end
167
+
168
+ # Checks equality by comparing each attribute.
169
+ # @param [Object] Object to be compared
170
+ def ==(o)
171
+ return true if self.equal?(o)
172
+ self.class == o.class &&
173
+ id == o.id &&
174
+ remote_id == o.remote_id &&
175
+ remote_data == o.remote_data &&
176
+ number == o.number &&
177
+ transaction_date == o.transaction_date &&
178
+ vendor == o.vendor &&
179
+ total_amount == o.total_amount &&
180
+ currency == o.currency &&
181
+ lines == o.lines &&
182
+ remote_was_deleted == o.remote_was_deleted
183
+ end
184
+
185
+ # @see the `==` method
186
+ # @param [Object] Object to be compared
187
+ def eql?(o)
188
+ self == o
189
+ end
190
+
191
+ # Calculates hash code according to all attributes.
192
+ # @return [Integer] Hash code
193
+ def hash
194
+ [id, remote_id, remote_data, number, transaction_date, vendor, total_amount, currency, lines, remote_was_deleted].hash
195
+ end
196
+
197
+ # Builds the object from hash
198
+ # @param [Hash] attributes Model attributes in the form of hash
199
+ # @return [Object] Returns the model itself
200
+ def self.build_from_hash(attributes)
201
+ new.build_from_hash(attributes)
202
+ end
203
+
204
+ # Builds the object from hash
205
+ # @param [Hash] attributes Model attributes in the form of hash
206
+ # @return [Object] Returns the model itself
207
+ def build_from_hash(attributes)
208
+ return nil unless attributes.is_a?(Hash)
209
+ self.class.openapi_types.each_pair do |key, type|
210
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
211
+ self.send("#{key}=", nil)
212
+ elsif type =~ /\AArray<(.*)>/i
213
+ # check to ensure the input is an array given that the attribute
214
+ # is documented as an array but the input is not
215
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
216
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
217
+ end
218
+ elsif !attributes[self.class.attribute_map[key]].nil?
219
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
220
+ end
221
+ end
222
+
223
+ self
224
+ end
225
+
226
+ # Deserializes the data based on type
227
+ # @param string type Data type
228
+ # @param string value Value to be deserialized
229
+ # @return [Object] Deserialized data
230
+ def _deserialize(type, value)
231
+ case type.to_sym
232
+ when :Time
233
+ Time.parse(value)
234
+ when :Date
235
+ Date.parse(value)
236
+ when :String
237
+ value
238
+ when :Integer
239
+ value.to_i
240
+ when :Float
241
+ value.to_f
242
+ when :Boolean
243
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
244
+ true
245
+ else
246
+ false
247
+ end
248
+ when :Object
249
+ # generic object (usually a Hash), return directly
250
+ value
251
+ when /\AArray<(?<inner_type>.+)>\z/
252
+ inner_type = Regexp.last_match[:inner_type]
253
+ value.map { |v| _deserialize(inner_type, v) }
254
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
255
+ k_type = Regexp.last_match[:k_type]
256
+ v_type = Regexp.last_match[:v_type]
257
+ {}.tap do |hash|
258
+ value.each do |k, v|
259
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
260
+ end
261
+ end
262
+ else # model
263
+ # models (e.g. Pet) or oneOf
264
+ klass = MergeAccountingClient.const_get(type)
265
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
266
+ end
267
+ end
268
+
269
+ # Returns the string representation of the object
270
+ # @return [String] String presentation of the object
271
+ def to_s
272
+ to_hash.to_s
273
+ end
274
+
275
+ # to_body is an alias to to_hash (backward compatibility)
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_body
278
+ to_hash
279
+ end
280
+
281
+ # Returns the object in the form of hash
282
+ # @return [Hash] Returns the object in the form of hash
283
+ def to_hash
284
+ hash = {}
285
+ self.class.attribute_map.each_pair do |attr, param|
286
+ value = self.send(attr)
287
+ if value.nil?
288
+ is_nullable = self.class.openapi_nullable.include?(attr)
289
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
290
+ end
291
+
292
+ hash[param] = _to_hash(value)
293
+ end
294
+ hash
295
+ end
296
+
297
+ # Outputs non-array value in the form of hash
298
+ # For object, use to_hash. Otherwise, just return the value
299
+ # @param [Object] value Any valid value
300
+ # @return [Hash] Returns the value in the form of hash
301
+ def _to_hash(value)
302
+ if value.is_a?(Array)
303
+ value.compact.map { |v| _to_hash(v) }
304
+ elsif value.is_a?(Hash)
305
+ {}.tap do |hash|
306
+ value.each { |k, v| hash[k] = _to_hash(v) }
307
+ end
308
+ elsif value.respond_to? :to_hash
309
+ value.to_hash
310
+ else
311
+ value
312
+ end
313
+ end
314
+
315
+ end
316
+
317
+ end