xero-ruby 3.6.0 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 471817aae937985bd56abe5d70a1e3d078c24e2d87971205e30c1583a05c3e37
4
- data.tar.gz: 70990d160ea9bdaac183acd06eaab41e0b680525b386b2c1411cf33ec3fbef9a
3
+ metadata.gz: 29e6f0618655087a784f836d1267fca44bde1a7ab7d0e43fa979eee59e635185
4
+ data.tar.gz: b62700762b38fe788780dfc19bd0bd40b9cfe14911c66b431449c815aa8c9469
5
5
  SHA512:
6
- metadata.gz: 5f47679440b82e924e68da60d26fbb6d7062c47ef026272be763740ad826392781d7dd260a04b5e139d09de2a54336c0602c51746df819554e2a625f8fdf7dbd
7
- data.tar.gz: 353ca2bcb1d9395d5d68fdb3474ab1c86f54f9474bd8b5135616c3469173683c927d2bea4cfd5a457dae2ab1ee4caf34ff6c9adac81c7f219e8dba3e4f1298fe
6
+ metadata.gz: 9d3c5d78a58a4a32a53f4cbf4b5e236730bb93362534c43d4d201e8543aa82b77ceda220a76feab29c4bfea7112b0d69f83e1552170fbe6eeca6b0fb16a3bf82
7
+ data.tar.gz: 6912ff3d5ba867f63e7694fa14899f32641e0e9a8525d187a6576b969f1a81ef7349e28b2ef29b91b0b0ef2b117b57ad90980c6cbc4ef8fdcd302ee47240b5bf
@@ -315,6 +315,101 @@ module XeroRuby
315
315
  return data, status_code, headers
316
316
  end
317
317
 
318
+ # Get Bank Statement Accounting
319
+ # For lenders that prefer using bank statement data as the source of truth. We provide a data point that will allow access to customer bank statements, plus for reconciled bank transactions the matching accounting, invoice and billing data as well. As customers reconcile bank statements to invoices and bills, this transaction detail will provide valuable insight for lender's assessment measures.
320
+ # @param xero_tenant_id [String] Xero identifier for Tenant
321
+ # @param bank_account_id [String] string, GUID Bank account Id
322
+ # @param from_date [String] date, yyyy-MM-dd Specifies the start date of the query period. The maximum range of the query period is 12 months. If the specified query period is more than 12 months the request will be rejected.
323
+ # @param to_date [String] date, yyyy-MM-dd Specifies the end date of the query period. If the end date is a future date, the request will be rejected.
324
+ # @param [Hash] opts the optional parameters
325
+ # @option opts [Boolean] :summary_only boolean, true/false The default value is true if no parameter is provided. In summary mode, the response will exclude the computation-heavy LineItems fields from bank transaction, invoice, credit note, prepayment and overpayment data, making the API calls quicker and more efficient.
326
+ # @return [BankStatementAccountingResponse]
327
+ def get_bank_statement_accounting(xero_tenant_id, bank_account_id, from_date, to_date, opts = {})
328
+ data, _status_code, _headers = get_bank_statement_accounting_with_http_info(xero_tenant_id, bank_account_id, from_date, to_date, opts)
329
+ data
330
+ end
331
+
332
+ # Get Bank Statement Accounting
333
+ # For lenders that prefer using bank statement data as the source of truth. We provide a data point that will allow access to customer bank statements, plus for reconciled bank transactions the matching accounting, invoice and billing data as well. As customers reconcile bank statements to invoices and bills, this transaction detail will provide valuable insight for lender's assessment measures.
334
+ # @param xero_tenant_id [String] Xero identifier for Tenant
335
+ # @param bank_account_id [String] string, GUID Bank account Id
336
+ # @param from_date [String] date, yyyy-MM-dd Specifies the start date of the query period. The maximum range of the query period is 12 months. If the specified query period is more than 12 months the request will be rejected.
337
+ # @param to_date [String] date, yyyy-MM-dd Specifies the end date of the query period. If the end date is a future date, the request will be rejected.
338
+ # @param [Hash] opts the optional parameters
339
+ # @option opts [Boolean] :summary_only boolean, true/false The default value is true if no parameter is provided. In summary mode, the response will exclude the computation-heavy LineItems fields from bank transaction, invoice, credit note, prepayment and overpayment data, making the API calls quicker and more efficient.
340
+ # @return [Array<(BankStatementAccountingResponse, Integer, Hash)>] BankStatementAccountingResponse data, response status code and response headers
341
+ def get_bank_statement_accounting_with_http_info(xero_tenant_id, bank_account_id, from_date, to_date, options = {})
342
+ opts = options.dup
343
+ if @api_client.config.debugging
344
+ @api_client.config.logger.debug 'Calling API: FinanceApi.get_bank_statement_accounting ...'
345
+ end
346
+ # verify the required parameter 'xero_tenant_id' is set
347
+ if @api_client.config.client_side_validation && xero_tenant_id.nil?
348
+ fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FinanceApi.get_bank_statement_accounting"
349
+ end
350
+ # verify the required parameter 'bank_account_id' is set
351
+ if @api_client.config.client_side_validation && bank_account_id.nil?
352
+ fail ArgumentError, "Missing the required parameter 'bank_account_id' when calling FinanceApi.get_bank_statement_accounting"
353
+ end
354
+ # verify the required parameter 'from_date' is set
355
+ if @api_client.config.client_side_validation && from_date.nil?
356
+ fail ArgumentError, "Missing the required parameter 'from_date' when calling FinanceApi.get_bank_statement_accounting"
357
+ end
358
+ # verify the required parameter 'to_date' is set
359
+ if @api_client.config.client_side_validation && to_date.nil?
360
+ fail ArgumentError, "Missing the required parameter 'to_date' when calling FinanceApi.get_bank_statement_accounting"
361
+ end
362
+ # resource path
363
+ local_var_path = '/BankStatementsPlus/statements'
364
+
365
+ # camelize keys of incoming `where` opts
366
+ opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?
367
+
368
+ # query parameters
369
+ query_params = opts[:query_params] || {}
370
+ query_params[:'BankAccountID'] = bank_account_id
371
+ query_params[:'FromDate'] = from_date
372
+ query_params[:'ToDate'] = to_date
373
+ query_params[:'SummaryOnly'] = opts[:'summary_only'] if !opts[:'summary_only'].nil?
374
+
375
+ # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
376
+ query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
377
+ query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?
378
+
379
+ # header parameters
380
+ header_params = opts[:header_params] || {}
381
+ # HTTP header 'Accept' (if needed)
382
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
383
+ header_params[:'xero-tenant-id'] = xero_tenant_id
384
+
385
+ # form parameters
386
+ form_params = opts[:form_params] || {}
387
+
388
+ # http body (model)
389
+ post_body = opts[:body]
390
+
391
+ # return_type
392
+ return_type = opts[:return_type] || 'BankStatementAccountingResponse'
393
+
394
+ # auth_names
395
+ auth_names = opts[:auth_names] || ['OAuth2']
396
+
397
+ new_options = opts.merge(
398
+ :header_params => header_params,
399
+ :query_params => query_params,
400
+ :form_params => form_params,
401
+ :body => post_body,
402
+ :auth_names => auth_names,
403
+ :return_type => return_type
404
+ )
405
+
406
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, "FinanceApi", new_options)
407
+ if @api_client.config.debugging
408
+ @api_client.config.logger.debug "API called: FinanceApi#get_bank_statement_accounting\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
409
+ end
410
+ return data, status_code, headers
411
+ end
412
+
318
413
  # Get cash validation
319
414
  # Summarizes the total cash position for each account for an org
320
415
  # @param xero_tenant_id [String] Xero identifier for Tenant
@@ -3594,7 +3594,7 @@ module XeroRuby
3594
3594
  # Retrieves employees
3595
3595
  # @param xero_tenant_id [String] Xero identifier for Tenant
3596
3596
  # @param [Hash] opts the optional parameters
3597
- # @option opts [String] :filter Filter by first name and/or lastname
3597
+ # @option opts [String] :filter Filter by first name, lastname, and/or whether they are an off-payroll worker
3598
3598
  # @option opts [Integer] :page Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.
3599
3599
  # @return [Employees]
3600
3600
  def get_employees(xero_tenant_id, opts = {})
@@ -3605,7 +3605,7 @@ module XeroRuby
3605
3605
  # Retrieves employees
3606
3606
  # @param xero_tenant_id [String] Xero identifier for Tenant
3607
3607
  # @param [Hash] opts the optional parameters
3608
- # @option opts [String] :filter Filter by first name and/or lastname
3608
+ # @option opts [String] :filter Filter by first name, lastname, and/or whether they are an off-payroll worker
3609
3609
  # @option opts [Integer] :page Page number which specifies the set of records to retrieve. By default the number of the records per set is 100.
3610
3610
  # @return [Array<(Employees, Integer, Hash)>] Employees data, response status code and response headers
3611
3611
  def get_employees_with_http_info(xero_tenant_id, options = {})
@@ -43,6 +43,9 @@ module XeroRuby::Accounting
43
43
  # The tax amount is auto calculated as a percentage of the line amount (see below) based on the tax rate. This value can be overriden if the calculated <TaxAmount> is not correct.
44
44
  attr_accessor :tax_amount
45
45
 
46
+
47
+ attr_accessor :item
48
+
46
49
  # If you wish to omit either of the <Quantity> or <UnitAmount> you can provide a LineAmount and Xero will calculate the missing amount for you. The line amount reflects the discounted price if a DiscountRate has been used . i.e LineAmount = Quantity * Unit Amount * ((100 – DiscountRate)/100)
47
50
  attr_accessor :line_amount
48
51
 
@@ -70,6 +73,7 @@ module XeroRuby::Accounting
70
73
  :'account_id' => :'AccountID',
71
74
  :'tax_type' => :'TaxType',
72
75
  :'tax_amount' => :'TaxAmount',
76
+ :'item' => :'Item',
73
77
  :'line_amount' => :'LineAmount',
74
78
  :'tracking' => :'Tracking',
75
79
  :'discount_rate' => :'DiscountRate',
@@ -90,6 +94,7 @@ module XeroRuby::Accounting
90
94
  :'account_id' => :'String',
91
95
  :'tax_type' => :'String',
92
96
  :'tax_amount' => :'BigDecimal',
97
+ :'item' => :'LineItemItem',
93
98
  :'line_amount' => :'BigDecimal',
94
99
  :'tracking' => :'Array<LineItemTracking>',
95
100
  :'discount_rate' => :'BigDecimal',
@@ -149,6 +154,10 @@ module XeroRuby::Accounting
149
154
  self.tax_amount = attributes[:'tax_amount']
150
155
  end
151
156
 
157
+ if attributes.key?(:'item')
158
+ self.item = attributes[:'item']
159
+ end
160
+
152
161
  if attributes.key?(:'line_amount')
153
162
  self.line_amount = attributes[:'line_amount']
154
163
  end
@@ -199,6 +208,7 @@ module XeroRuby::Accounting
199
208
  account_id == o.account_id &&
200
209
  tax_type == o.tax_type &&
201
210
  tax_amount == o.tax_amount &&
211
+ item == o.item &&
202
212
  line_amount == o.line_amount &&
203
213
  tracking == o.tracking &&
204
214
  discount_rate == o.discount_rate &&
@@ -215,7 +225,7 @@ module XeroRuby::Accounting
215
225
  # Calculates hash code according to all attributes.
216
226
  # @return [Integer] Hash code
217
227
  def hash
218
- [line_item_id, description, quantity, unit_amount, item_code, account_code, account_id, tax_type, tax_amount, line_amount, tracking, discount_rate, discount_amount, repeating_invoice_id].hash
228
+ [line_item_id, description, quantity, unit_amount, item_code, account_code, account_id, tax_type, tax_amount, item, line_amount, tracking, discount_rate, discount_amount, repeating_invoice_id].hash
219
229
  end
220
230
 
221
231
  # Builds the object from hash
@@ -0,0 +1,272 @@
1
+ =begin
2
+ #Xero Accounting API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ Contact: api@xero.com
7
+ Generated by: https://openapi-generator.tech
8
+ OpenAPI Generator version: 4.3.1
9
+
10
+ =end
11
+
12
+ require 'time'
13
+ require 'date'
14
+
15
+ module XeroRuby::Accounting
16
+ require 'bigdecimal'
17
+
18
+ class LineItemItem
19
+ # User defined item code (max length = 30)
20
+ attr_accessor :code
21
+
22
+ # The name of the item (max length = 50)
23
+ attr_accessor :name
24
+
25
+ # The Xero identifier for an Item
26
+ attr_accessor :item_id
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'code' => :'Code',
32
+ :'name' => :'Name',
33
+ :'item_id' => :'ItemID'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'code' => :'String',
41
+ :'name' => :'String',
42
+ :'item_id' => :'String'
43
+ }
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::LineItemItem` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Accounting::LineItemItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'code')
62
+ self.code = attributes[:'code']
63
+ end
64
+
65
+ if attributes.key?(:'name')
66
+ self.name = attributes[:'name']
67
+ end
68
+
69
+ if attributes.key?(:'item_id')
70
+ self.item_id = attributes[:'item_id']
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+ if !@code.nil? && @code.to_s.length > 30
79
+ invalid_properties.push('invalid value for "code", the character length must be smaller than or equal to 30.')
80
+ end
81
+
82
+ if !@name.nil? && @name.to_s.length > 50
83
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 50.')
84
+ end
85
+
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ return false if !@code.nil? && @code.to_s.length > 30
93
+ return false if !@name.nil? && @name.to_s.length > 50
94
+ true
95
+ end
96
+
97
+ # Custom attribute writer method with validation
98
+ # @param [Object] code Value to be assigned
99
+ def code=(code)
100
+ if !code.nil? && code.to_s.length > 30
101
+ fail ArgumentError, 'invalid value for "code", the character length must be smaller than or equal to 30.'
102
+ end
103
+
104
+ @code = code
105
+ end
106
+
107
+ # Custom attribute writer method with validation
108
+ # @param [Object] name Value to be assigned
109
+ def name=(name)
110
+ if !name.nil? && name.to_s.length > 50
111
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 50.'
112
+ end
113
+
114
+ @name = name
115
+ end
116
+
117
+ # Checks equality by comparing each attribute.
118
+ # @param [Object] Object to be compared
119
+ def ==(o)
120
+ return true if self.equal?(o)
121
+ self.class == o.class &&
122
+ code == o.code &&
123
+ name == o.name &&
124
+ item_id == o.item_id
125
+ end
126
+
127
+ # @see the `==` method
128
+ # @param [Object] Object to be compared
129
+ def eql?(o)
130
+ self == o
131
+ end
132
+
133
+ # Calculates hash code according to all attributes.
134
+ # @return [Integer] Hash code
135
+ def hash
136
+ [code, name, item_id].hash
137
+ end
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def self.build_from_hash(attributes)
143
+ new.build_from_hash(attributes)
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def build_from_hash(attributes)
150
+ return nil unless attributes.is_a?(Hash)
151
+ self.class.openapi_types.each_pair do |key, type|
152
+ if type =~ /\AArray<(.*)>/i
153
+ # check to ensure the input is an array given that the attribute
154
+ # is documented as an array but the input is not
155
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
156
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
157
+ end
158
+ elsif !attributes[self.class.attribute_map[key]].nil?
159
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
160
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
161
+ end
162
+
163
+ self
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def _deserialize(type, value)
171
+ case type.to_sym
172
+ when :DateTime
173
+ DateTime.parse(parse_date(value))
174
+ when :Date
175
+ Date.parse(parse_date(value))
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :BigDecimal
183
+ BigDecimal(value.to_s)
184
+ when :Boolean
185
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
186
+ true
187
+ else
188
+ false
189
+ end
190
+ when :Object
191
+ # generic object (usually a Hash), return directly
192
+ value
193
+ when /\AArray<(?<inner_type>.+)>\z/
194
+ inner_type = Regexp.last_match[:inner_type]
195
+ value.map { |v| _deserialize(inner_type, v) }
196
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
197
+ k_type = Regexp.last_match[:k_type]
198
+ v_type = Regexp.last_match[:v_type]
199
+ {}.tap do |hash|
200
+ value.each do |k, v|
201
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
202
+ end
203
+ end
204
+ else # model
205
+ XeroRuby::Accounting.const_get(type).build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
215
+ # to_body is an alias to to_hash (backward compatibility)
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_body
218
+ to_hash
219
+ end
220
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash(downcase: false)
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ next if value.nil?
228
+ key = downcase ? attr : param
229
+ hash[key] = _to_hash(value, downcase: downcase)
230
+ end
231
+ hash
232
+ end
233
+
234
+ # Returns the object in the form of hash with snake_case
235
+ def to_attributes
236
+ to_hash(downcase: true)
237
+ end
238
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param [Object] value Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value, downcase: false)
244
+ if value.is_a?(Array)
245
+ value.map do |v|
246
+ v.to_hash(downcase: downcase)
247
+ end
248
+ elsif value.is_a?(Hash)
249
+ {}.tap do |hash|
250
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
251
+ end
252
+ elsif value.respond_to? :to_hash
253
+ value.to_hash(downcase: downcase)
254
+ else
255
+ value
256
+ end
257
+ end
258
+
259
+ def parse_date(datestring)
260
+ if datestring.include?('Date')
261
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
262
+ original, date, timezone = *date_pattern.match(datestring)
263
+ date = (date.to_i / 1000)
264
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
265
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
266
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
267
+ else # handle date 'types' for small subset of payroll API's
268
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
269
+ end
270
+ end
271
+ end
272
+ end