xero-ruby 3.6.0 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xero-ruby/api/finance_api.rb +95 -0
- data/lib/xero-ruby/api/payroll_uk_api.rb +2 -2
- data/lib/xero-ruby/models/accounting/line_item.rb +11 -1
- data/lib/xero-ruby/models/accounting/line_item_item.rb +272 -0
- data/lib/xero-ruby/models/accounting/organisation.rb +6 -4
- data/lib/xero-ruby/models/app_store/product.rb +22 -11
- data/lib/xero-ruby/models/app_store/subscription_item.rb +11 -1
- data/lib/xero-ruby/models/finance/bank_statement_accounting_response.rb +254 -0
- data/lib/xero-ruby/models/finance/bank_transaction_response.rb +274 -0
- data/lib/xero-ruby/models/finance/contact_response.rb +232 -0
- data/lib/xero-ruby/models/finance/credit_note_response.rb +254 -0
- data/lib/xero-ruby/models/finance/invoice_response.rb +254 -0
- data/lib/xero-ruby/models/finance/line_item_response.rb +252 -0
- data/lib/xero-ruby/models/finance/overpayment_response.rb +254 -0
- data/lib/xero-ruby/models/finance/payment_response.rb +312 -0
- data/lib/xero-ruby/models/finance/prepayment_response.rb +254 -0
- data/lib/xero-ruby/models/finance/problem_type.rb +7 -2
- data/lib/xero-ruby/models/finance/statement_line_response.rb +346 -0
- data/lib/xero-ruby/models/finance/statement_response.rb +274 -0
- data/lib/xero-ruby/models/payroll_uk/employee.rb +14 -4
- data/lib/xero-ruby/models/payroll_uk/employment.rb +8 -3
- data/lib/xero-ruby/version.rb +2 -2
- data/lib/xero-ruby.rb +12 -0
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64ea98826b9c024df40c0e3db6390722313e610c19b74a32f9200aa032fa8de9
|
4
|
+
data.tar.gz: 2b8d8f8fe9bd8909d3ea64f814763787752313ef3b224218f4e373af5bf13a7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acf352b5dc0ab2bc6fe5de48b1ad0fdac7e90ecf1828f9a1184d93b4663f4a5c67b32085430471c4264fbbea98e2015ef30414da5324b5b522df84dde10ed5bc
|
7
|
+
data.tar.gz: b41a5a3cfd6cd0086991173efc0430c8b5d53e9776f0636400b1d53411f006e722b8f0c2bf903b3a4f0f487a3583fbdfe0d9d79cbeb18f387d18cefac64ddc69
|
@@ -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
|
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
|
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
|
@@ -50,6 +50,7 @@ module XeroRuby::Accounting
|
|
50
50
|
COMPANY ||= "COMPANY".freeze
|
51
51
|
CHARITY ||= "CHARITY".freeze
|
52
52
|
CLUB_OR_SOCIETY ||= "CLUB_OR_SOCIETY".freeze
|
53
|
+
INDIVIDUAL ||= "INDIVIDUAL".freeze
|
53
54
|
LOOK_THROUGH_COMPANY ||= "LOOK_THROUGH_COMPANY".freeze
|
54
55
|
NOT_FOR_PROFIT ||= "NOT_FOR_PROFIT".freeze
|
55
56
|
PARTNERSHIP ||= "PARTNERSHIP".freeze
|
@@ -139,6 +140,7 @@ module XeroRuby::Accounting
|
|
139
140
|
COMPANY ||= "COMPANY".freeze
|
140
141
|
CHARITY ||= "CHARITY".freeze
|
141
142
|
CLUB_OR_SOCIETY ||= "CLUB_OR_SOCIETY".freeze
|
143
|
+
INDIVIDUAL ||= "INDIVIDUAL".freeze
|
142
144
|
LOOK_THROUGH_COMPANY ||= "LOOK_THROUGH_COMPANY".freeze
|
143
145
|
NOT_FOR_PROFIT ||= "NOT_FOR_PROFIT".freeze
|
144
146
|
PARTNERSHIP ||= "PARTNERSHIP".freeze
|
@@ -451,13 +453,13 @@ module XeroRuby::Accounting
|
|
451
453
|
def valid?
|
452
454
|
version_validator = EnumAttributeValidator.new('String', ["AU", "NZ", "GLOBAL", "UK", "US", "AUONRAMP", "NZONRAMP", "GLOBALONRAMP", "UKONRAMP", "USONRAMP"])
|
453
455
|
return false unless version_validator.valid?(@version)
|
454
|
-
organisation_type_validator = EnumAttributeValidator.new('String', ["ACCOUNTING_PRACTICE", "COMPANY", "CHARITY", "CLUB_OR_SOCIETY", "LOOK_THROUGH_COMPANY", "NOT_FOR_PROFIT", "PARTNERSHIP", "S_CORPORATION", "SELF_MANAGED_SUPERANNUATION_FUND", "SOLE_TRADER", "SUPERANNUATION_FUND", "TRUST"])
|
456
|
+
organisation_type_validator = EnumAttributeValidator.new('String', ["ACCOUNTING_PRACTICE", "COMPANY", "CHARITY", "CLUB_OR_SOCIETY", "INDIVIDUAL", "LOOK_THROUGH_COMPANY", "NOT_FOR_PROFIT", "PARTNERSHIP", "S_CORPORATION", "SELF_MANAGED_SUPERANNUATION_FUND", "SOLE_TRADER", "SUPERANNUATION_FUND", "TRUST"])
|
455
457
|
return false unless organisation_type_validator.valid?(@organisation_type)
|
456
458
|
sales_tax_basis_validator = EnumAttributeValidator.new('String', ["PAYMENTS", "INVOICE", "NONE", "CASH", "ACCRUAL", "FLATRATECASH", "FLATRATEACCRUAL", "ACCRUALS"])
|
457
459
|
return false unless sales_tax_basis_validator.valid?(@sales_tax_basis)
|
458
460
|
sales_tax_period_validator = EnumAttributeValidator.new('String', ["MONTHLY", "QUARTERLY1", "QUARTERLY2", "QUARTERLY3", "ANNUALLY", "ONEMONTHS", "TWOMONTHS", "SIXMONTHS", "1MONTHLY", "2MONTHLY", "3MONTHLY", "6MONTHLY", "QUARTERLY", "YEARLY", "NONE"])
|
459
461
|
return false unless sales_tax_period_validator.valid?(@sales_tax_period)
|
460
|
-
organisation_entity_type_validator = EnumAttributeValidator.new('String', ["ACCOUNTING_PRACTICE", "COMPANY", "CHARITY", "CLUB_OR_SOCIETY", "LOOK_THROUGH_COMPANY", "NOT_FOR_PROFIT", "PARTNERSHIP", "S_CORPORATION", "SELF_MANAGED_SUPERANNUATION_FUND", "SOLE_TRADER", "SUPERANNUATION_FUND", "TRUST"])
|
462
|
+
organisation_entity_type_validator = EnumAttributeValidator.new('String', ["ACCOUNTING_PRACTICE", "COMPANY", "CHARITY", "CLUB_OR_SOCIETY", "INDIVIDUAL", "LOOK_THROUGH_COMPANY", "NOT_FOR_PROFIT", "PARTNERSHIP", "S_CORPORATION", "SELF_MANAGED_SUPERANNUATION_FUND", "SOLE_TRADER", "SUPERANNUATION_FUND", "TRUST"])
|
461
463
|
return false unless organisation_entity_type_validator.valid?(@organisation_entity_type)
|
462
464
|
_class_validator = EnumAttributeValidator.new('String', ["DEMO", "TRIAL", "STARTER", "STANDARD", "PREMIUM", "PREMIUM_20", "PREMIUM_50", "PREMIUM_100", "LEDGER", "GST_CASHBOOK", "NON_GST_CASHBOOK"])
|
463
465
|
return false unless _class_validator.valid?(@_class)
|
@@ -479,7 +481,7 @@ module XeroRuby::Accounting
|
|
479
481
|
# Custom attribute writer method checking allowed values (enum).
|
480
482
|
# @param [Object] organisation_type Object to be assigned
|
481
483
|
def organisation_type=(organisation_type)
|
482
|
-
validator = EnumAttributeValidator.new('String', ["ACCOUNTING_PRACTICE", "COMPANY", "CHARITY", "CLUB_OR_SOCIETY", "LOOK_THROUGH_COMPANY", "NOT_FOR_PROFIT", "PARTNERSHIP", "S_CORPORATION", "SELF_MANAGED_SUPERANNUATION_FUND", "SOLE_TRADER", "SUPERANNUATION_FUND", "TRUST"])
|
484
|
+
validator = EnumAttributeValidator.new('String', ["ACCOUNTING_PRACTICE", "COMPANY", "CHARITY", "CLUB_OR_SOCIETY", "INDIVIDUAL", "LOOK_THROUGH_COMPANY", "NOT_FOR_PROFIT", "PARTNERSHIP", "S_CORPORATION", "SELF_MANAGED_SUPERANNUATION_FUND", "SOLE_TRADER", "SUPERANNUATION_FUND", "TRUST"])
|
483
485
|
unless validator.valid?(organisation_type)
|
484
486
|
fail ArgumentError, "invalid value for \"organisation_type\", must be one of #{validator.allowable_values}."
|
485
487
|
end
|
@@ -509,7 +511,7 @@ module XeroRuby::Accounting
|
|
509
511
|
# Custom attribute writer method checking allowed values (enum).
|
510
512
|
# @param [Object] organisation_entity_type Object to be assigned
|
511
513
|
def organisation_entity_type=(organisation_entity_type)
|
512
|
-
validator = EnumAttributeValidator.new('String', ["ACCOUNTING_PRACTICE", "COMPANY", "CHARITY", "CLUB_OR_SOCIETY", "LOOK_THROUGH_COMPANY", "NOT_FOR_PROFIT", "PARTNERSHIP", "S_CORPORATION", "SELF_MANAGED_SUPERANNUATION_FUND", "SOLE_TRADER", "SUPERANNUATION_FUND", "TRUST"])
|
514
|
+
validator = EnumAttributeValidator.new('String', ["ACCOUNTING_PRACTICE", "COMPANY", "CHARITY", "CLUB_OR_SOCIETY", "INDIVIDUAL", "LOOK_THROUGH_COMPANY", "NOT_FOR_PROFIT", "PARTNERSHIP", "S_CORPORATION", "SELF_MANAGED_SUPERANNUATION_FUND", "SOLE_TRADER", "SUPERANNUATION_FUND", "TRUST"])
|
513
515
|
unless validator.valid?(organisation_entity_type)
|
514
516
|
fail ArgumentError, "invalid value for \"organisation_entity_type\", must be one of #{validator.allowable_values}."
|
515
517
|
end
|
@@ -22,13 +22,17 @@ module XeroRuby::AppStore
|
|
22
22
|
# The name of the product
|
23
23
|
attr_accessor :name
|
24
24
|
|
25
|
-
# The
|
25
|
+
# The unit of the per seat product. e.g. \"user\", \"organisation\", \"SMS\", etc
|
26
|
+
attr_accessor :seat_unit
|
27
|
+
|
28
|
+
# The pricing model of the product: * FIXED: Customers are charged a fixed amount for each billing period * PER_SEAT: Customers are charged based on the number of units they purchase * METERED: Customers are charged per use of this product
|
26
29
|
attr_accessor :type
|
27
30
|
FIXED ||= "FIXED".freeze
|
28
31
|
PER_SEAT ||= "PER_SEAT".freeze
|
32
|
+
METERED ||= "METERED".freeze
|
29
33
|
|
30
|
-
# The unit of the
|
31
|
-
attr_accessor :
|
34
|
+
# The unit of the usage product. e.g. \"user\", \"minutes\", \"SMS\", etc
|
35
|
+
attr_accessor :usage_unit
|
32
36
|
|
33
37
|
class EnumAttributeValidator
|
34
38
|
attr_reader :datatype
|
@@ -57,8 +61,9 @@ module XeroRuby::AppStore
|
|
57
61
|
{
|
58
62
|
:'id' => :'id',
|
59
63
|
:'name' => :'name',
|
64
|
+
:'seat_unit' => :'seatUnit',
|
60
65
|
:'type' => :'type',
|
61
|
-
:'
|
66
|
+
:'usage_unit' => :'usageUnit'
|
62
67
|
}
|
63
68
|
end
|
64
69
|
|
@@ -67,8 +72,9 @@ module XeroRuby::AppStore
|
|
67
72
|
{
|
68
73
|
:'id' => :'String',
|
69
74
|
:'name' => :'String',
|
75
|
+
:'seat_unit' => :'String',
|
70
76
|
:'type' => :'String',
|
71
|
-
:'
|
77
|
+
:'usage_unit' => :'String'
|
72
78
|
}
|
73
79
|
end
|
74
80
|
|
@@ -95,12 +101,16 @@ module XeroRuby::AppStore
|
|
95
101
|
self.name = attributes[:'name']
|
96
102
|
end
|
97
103
|
|
104
|
+
if attributes.key?(:'seat_unit')
|
105
|
+
self.seat_unit = attributes[:'seat_unit']
|
106
|
+
end
|
107
|
+
|
98
108
|
if attributes.key?(:'type')
|
99
109
|
self.type = attributes[:'type']
|
100
110
|
end
|
101
111
|
|
102
|
-
if attributes.key?(:'
|
103
|
-
self.
|
112
|
+
if attributes.key?(:'usage_unit')
|
113
|
+
self.usage_unit = attributes[:'usage_unit']
|
104
114
|
end
|
105
115
|
end
|
106
116
|
|
@@ -114,7 +124,7 @@ module XeroRuby::AppStore
|
|
114
124
|
# Check to see if the all the properties in the model are valid
|
115
125
|
# @return true if the model is valid
|
116
126
|
def valid?
|
117
|
-
type_validator = EnumAttributeValidator.new('String', ["FIXED", "PER_SEAT"])
|
127
|
+
type_validator = EnumAttributeValidator.new('String', ["FIXED", "PER_SEAT", "METERED"])
|
118
128
|
return false unless type_validator.valid?(@type)
|
119
129
|
true
|
120
130
|
end
|
@@ -122,7 +132,7 @@ module XeroRuby::AppStore
|
|
122
132
|
# Custom attribute writer method checking allowed values (enum).
|
123
133
|
# @param [Object] type Object to be assigned
|
124
134
|
def type=(type)
|
125
|
-
validator = EnumAttributeValidator.new('String', ["FIXED", "PER_SEAT"])
|
135
|
+
validator = EnumAttributeValidator.new('String', ["FIXED", "PER_SEAT", "METERED"])
|
126
136
|
unless validator.valid?(type)
|
127
137
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
128
138
|
end
|
@@ -136,8 +146,9 @@ module XeroRuby::AppStore
|
|
136
146
|
self.class == o.class &&
|
137
147
|
id == o.id &&
|
138
148
|
name == o.name &&
|
149
|
+
seat_unit == o.seat_unit &&
|
139
150
|
type == o.type &&
|
140
|
-
|
151
|
+
usage_unit == o.usage_unit
|
141
152
|
end
|
142
153
|
|
143
154
|
# @see the `==` method
|
@@ -149,7 +160,7 @@ module XeroRuby::AppStore
|
|
149
160
|
# Calculates hash code according to all attributes.
|
150
161
|
# @return [Integer] Hash code
|
151
162
|
def hash
|
152
|
-
[id, name, type,
|
163
|
+
[id, name, seat_unit, type, usage_unit].hash
|
153
164
|
end
|
154
165
|
|
155
166
|
# Builds the object from hash
|
@@ -28,6 +28,9 @@ module XeroRuby::AppStore
|
|
28
28
|
|
29
29
|
attr_accessor :product
|
30
30
|
|
31
|
+
# The quantity of the item. For a fixed product, it is 1. For a per-seat product, it is a positive integer. For metered products, it is always null.
|
32
|
+
attr_accessor :quantity
|
33
|
+
|
31
34
|
# Date the subscription started, or will start. Note: this could be in the future for downgrades or reduced number of seats that haven't taken effect yet.
|
32
35
|
attr_accessor :start_date
|
33
36
|
|
@@ -69,6 +72,7 @@ module XeroRuby::AppStore
|
|
69
72
|
:'id' => :'id',
|
70
73
|
:'price' => :'price',
|
71
74
|
:'product' => :'product',
|
75
|
+
:'quantity' => :'quantity',
|
72
76
|
:'start_date' => :'startDate',
|
73
77
|
:'status' => :'status',
|
74
78
|
:'test_mode' => :'testMode'
|
@@ -82,6 +86,7 @@ module XeroRuby::AppStore
|
|
82
86
|
:'id' => :'String',
|
83
87
|
:'price' => :'Price',
|
84
88
|
:'product' => :'Product',
|
89
|
+
:'quantity' => :'Integer',
|
85
90
|
:'start_date' => :'DateTime',
|
86
91
|
:'status' => :'String',
|
87
92
|
:'test_mode' => :'Boolean'
|
@@ -119,6 +124,10 @@ module XeroRuby::AppStore
|
|
119
124
|
self.product = attributes[:'product']
|
120
125
|
end
|
121
126
|
|
127
|
+
if attributes.key?(:'quantity')
|
128
|
+
self.quantity = attributes[:'quantity']
|
129
|
+
end
|
130
|
+
|
122
131
|
if attributes.key?(:'start_date')
|
123
132
|
self.start_date = attributes[:'start_date']
|
124
133
|
end
|
@@ -191,6 +200,7 @@ module XeroRuby::AppStore
|
|
191
200
|
id == o.id &&
|
192
201
|
price == o.price &&
|
193
202
|
product == o.product &&
|
203
|
+
quantity == o.quantity &&
|
194
204
|
start_date == o.start_date &&
|
195
205
|
status == o.status &&
|
196
206
|
test_mode == o.test_mode
|
@@ -205,7 +215,7 @@ module XeroRuby::AppStore
|
|
205
215
|
# Calculates hash code according to all attributes.
|
206
216
|
# @return [Integer] Hash code
|
207
217
|
def hash
|
208
|
-
[end_date, id, price, product, start_date, status, test_mode].hash
|
218
|
+
[end_date, id, price, product, quantity, start_date, status, test_mode].hash
|
209
219
|
end
|
210
220
|
|
211
221
|
# Builds the object from hash
|