xero-ruby 3.16.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/xero-ruby/api/accounting_api.rb +645 -3
- data/lib/xero-ruby/api/app_store_api.rb +6 -0
- data/lib/xero-ruby/api/asset_api.rb +16 -6
- data/lib/xero-ruby/api/files_api.rb +156 -20
- data/lib/xero-ruby/api/payroll_au_api.rb +326 -30
- data/lib/xero-ruby/api/payroll_nz_api.rb +417 -7
- data/lib/xero-ruby/api/payroll_uk_api.rb +81 -0
- data/lib/xero-ruby/api/project_api.rb +21 -0
- data/lib/xero-ruby/api_client.rb +7 -7
- data/lib/xero-ruby/models/accounting/account_type.rb +0 -4
- data/lib/xero-ruby/models/accounting/allocation.rb +21 -1
- data/lib/xero-ruby/models/accounting/bank_transactions.rb +23 -1
- data/lib/xero-ruby/models/accounting/contact.rb +1 -11
- data/lib/xero-ruby/models/accounting/contacts.rb +23 -1
- data/lib/xero-ruby/models/accounting/credit_note.rb +17 -5
- data/lib/xero-ruby/models/accounting/credit_notes.rb +23 -1
- data/lib/xero-ruby/models/accounting/currency_code.rb +10 -8
- data/lib/xero-ruby/models/accounting/invoice.rb +16 -4
- data/lib/xero-ruby/models/accounting/invoice_address.rb +338 -0
- data/lib/xero-ruby/models/accounting/invoices.rb +23 -1
- data/lib/xero-ruby/models/accounting/journals.rb +13 -1
- data/lib/xero-ruby/models/accounting/line_item.rb +75 -4
- data/lib/xero-ruby/models/accounting/manual_journals.rb +23 -1
- data/lib/xero-ruby/models/accounting/organisation.rb +9 -2
- data/lib/xero-ruby/models/accounting/overpayments.rb +23 -1
- data/lib/xero-ruby/models/accounting/pagination.rb +252 -0
- data/lib/xero-ruby/models/accounting/payment.rb +16 -4
- data/lib/xero-ruby/models/accounting/payments.rb +23 -1
- data/lib/xero-ruby/models/accounting/prepayments.rb +23 -1
- data/lib/xero-ruby/models/accounting/purchase_orders.rb +23 -1
- data/lib/xero-ruby/models/accounting/tax_breakdown_component.rb +351 -0
- data/lib/xero-ruby/models/accounting/tax_rate.rb +13 -6
- data/lib/xero-ruby/models/accounting/tax_type.rb +45 -4
- data/lib/xero-ruby/models/accounting/ten_ninety_nine_contact.rb +75 -4
- data/lib/xero-ruby/models/files/association.rb +31 -1
- data/lib/xero-ruby/models/finance/current_statement_response.rb +1 -1
- data/lib/xero-ruby/models/finance/data_source_response.rb +13 -43
- data/lib/xero-ruby/models/finance/problem_type.rb +1 -0
- data/lib/xero-ruby/models/finance/statement_line_response.rb +11 -1
- data/lib/xero-ruby/models/finance/statement_response.rb +24 -4
- data/lib/xero-ruby/models/payroll_au/allowance_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/country_of_residence.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/earnings_rate.rb +21 -1
- data/lib/xero-ruby/models/payroll_au/leave_application.rb +11 -1
- data/lib/xero-ruby/models/payroll_au/leave_earnings_line.rb +14 -4
- data/lib/xero-ruby/models/payroll_au/leave_line_calculation_type.rb +0 -1
- data/lib/xero-ruby/models/payroll_au/leave_period_status.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/opening_balances.rb +16 -4
- data/lib/xero-ruby/models/payroll_au/paid_leave_earnings_line.rb +272 -0
- data/lib/xero-ruby/models/payroll_au/pay_out_type.rb +36 -0
- data/lib/xero-ruby/models/payroll_nz/employee.rb +34 -4
- data/lib/xero-ruby/models/payroll_nz/employee_leave_setup.rb +56 -6
- data/lib/xero-ruby/models/payroll_nz/employee_leave_type.rb +47 -7
- data/lib/xero-ruby/models/payroll_nz/employee_working_pattern.rb +242 -0
- data/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks.rb +254 -0
- data/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_object.rb +242 -0
- data/lib/xero-ruby/models/payroll_nz/employee_working_pattern_with_working_weeks_request.rb +244 -0
- data/lib/xero-ruby/models/payroll_nz/employee_working_patterns_object.rb +244 -0
- data/lib/xero-ruby/models/payroll_nz/employment.rb +24 -4
- data/lib/xero-ruby/models/payroll_nz/leave_period.rb +35 -4
- data/lib/xero-ruby/models/payroll_nz/leave_type.rb +24 -4
- data/lib/xero-ruby/models/payroll_nz/salary_and_wage.rb +28 -4
- data/lib/xero-ruby/models/payroll_nz/working_week.rb +317 -0
- data/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +3 -3
- data/lib/xero-ruby/models/payroll_uk/employee_leave_type.rb +14 -4
- data/lib/xero-ruby/models/projects/currency_code.rb +0 -1
- data/lib/xero-ruby/version.rb +2 -2
- data/lib/xero-ruby/where.rb +37 -37
- data/lib/xero-ruby.rb +11 -0
- data/spec/api_client_spec.rb +56 -56
- data/spec/api_error_spec.rb +1 -1
- data/spec/configuration_spec.rb +2 -2
- data/spec/helper_methods_spec.rb +3 -3
- data/spec/where_spec.rb +2 -2
- metadata +38 -27
@@ -17,11 +17,19 @@ module XeroRuby::Accounting
|
|
17
17
|
|
18
18
|
class Prepayments
|
19
19
|
|
20
|
+
attr_accessor :pagination
|
21
|
+
|
22
|
+
# Displays array of warning messages from the API
|
23
|
+
attr_accessor :warnings
|
24
|
+
|
25
|
+
|
20
26
|
attr_accessor :prepayments
|
21
27
|
|
22
28
|
# Attribute mapping from ruby-style variable name to JSON key.
|
23
29
|
def self.attribute_map
|
24
30
|
{
|
31
|
+
:'pagination' => :'pagination',
|
32
|
+
:'warnings' => :'Warnings',
|
25
33
|
:'prepayments' => :'Prepayments'
|
26
34
|
}
|
27
35
|
end
|
@@ -29,6 +37,8 @@ module XeroRuby::Accounting
|
|
29
37
|
# Attribute type mapping.
|
30
38
|
def self.openapi_types
|
31
39
|
{
|
40
|
+
:'pagination' => :'Pagination',
|
41
|
+
:'warnings' => :'Array<ValidationError>',
|
32
42
|
:'prepayments' => :'Array<Prepayment>'
|
33
43
|
}
|
34
44
|
end
|
@@ -48,6 +58,16 @@ module XeroRuby::Accounting
|
|
48
58
|
h[k.to_sym] = v
|
49
59
|
}
|
50
60
|
|
61
|
+
if attributes.key?(:'pagination')
|
62
|
+
self.pagination = attributes[:'pagination']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.key?(:'warnings')
|
66
|
+
if (value = attributes[:'warnings']).is_a?(Array)
|
67
|
+
self.warnings = value
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
51
71
|
if attributes.key?(:'prepayments')
|
52
72
|
if (value = attributes[:'prepayments']).is_a?(Array)
|
53
73
|
self.prepayments = value
|
@@ -73,6 +93,8 @@ module XeroRuby::Accounting
|
|
73
93
|
def ==(o)
|
74
94
|
return true if self.equal?(o)
|
75
95
|
self.class == o.class &&
|
96
|
+
pagination == o.pagination &&
|
97
|
+
warnings == o.warnings &&
|
76
98
|
prepayments == o.prepayments
|
77
99
|
end
|
78
100
|
|
@@ -85,7 +107,7 @@ module XeroRuby::Accounting
|
|
85
107
|
# Calculates hash code according to all attributes.
|
86
108
|
# @return [Integer] Hash code
|
87
109
|
def hash
|
88
|
-
[prepayments].hash
|
110
|
+
[pagination, warnings, prepayments].hash
|
89
111
|
end
|
90
112
|
|
91
113
|
# Builds the object from hash
|
@@ -17,11 +17,19 @@ module XeroRuby::Accounting
|
|
17
17
|
|
18
18
|
class PurchaseOrders
|
19
19
|
|
20
|
+
attr_accessor :pagination
|
21
|
+
|
22
|
+
# Displays array of warning messages from the API
|
23
|
+
attr_accessor :warnings
|
24
|
+
|
25
|
+
|
20
26
|
attr_accessor :purchase_orders
|
21
27
|
|
22
28
|
# Attribute mapping from ruby-style variable name to JSON key.
|
23
29
|
def self.attribute_map
|
24
30
|
{
|
31
|
+
:'pagination' => :'pagination',
|
32
|
+
:'warnings' => :'Warnings',
|
25
33
|
:'purchase_orders' => :'PurchaseOrders'
|
26
34
|
}
|
27
35
|
end
|
@@ -29,6 +37,8 @@ module XeroRuby::Accounting
|
|
29
37
|
# Attribute type mapping.
|
30
38
|
def self.openapi_types
|
31
39
|
{
|
40
|
+
:'pagination' => :'Pagination',
|
41
|
+
:'warnings' => :'Array<ValidationError>',
|
32
42
|
:'purchase_orders' => :'Array<PurchaseOrder>'
|
33
43
|
}
|
34
44
|
end
|
@@ -48,6 +58,16 @@ module XeroRuby::Accounting
|
|
48
58
|
h[k.to_sym] = v
|
49
59
|
}
|
50
60
|
|
61
|
+
if attributes.key?(:'pagination')
|
62
|
+
self.pagination = attributes[:'pagination']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.key?(:'warnings')
|
66
|
+
if (value = attributes[:'warnings']).is_a?(Array)
|
67
|
+
self.warnings = value
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
51
71
|
if attributes.key?(:'purchase_orders')
|
52
72
|
if (value = attributes[:'purchase_orders']).is_a?(Array)
|
53
73
|
self.purchase_orders = value
|
@@ -73,6 +93,8 @@ module XeroRuby::Accounting
|
|
73
93
|
def ==(o)
|
74
94
|
return true if self.equal?(o)
|
75
95
|
self.class == o.class &&
|
96
|
+
pagination == o.pagination &&
|
97
|
+
warnings == o.warnings &&
|
76
98
|
purchase_orders == o.purchase_orders
|
77
99
|
end
|
78
100
|
|
@@ -85,7 +107,7 @@ module XeroRuby::Accounting
|
|
85
107
|
# Calculates hash code according to all attributes.
|
86
108
|
# @return [Integer] Hash code
|
87
109
|
def hash
|
88
|
-
[purchase_orders].hash
|
110
|
+
[pagination, warnings, purchase_orders].hash
|
89
111
|
end
|
90
112
|
|
91
113
|
# Builds the object from hash
|
@@ -0,0 +1,351 @@
|
|
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 TaxBreakdownComponent
|
19
|
+
# The unique ID number of this component
|
20
|
+
attr_accessor :tax_component_id
|
21
|
+
|
22
|
+
# The type of the jurisdiction
|
23
|
+
attr_accessor :type
|
24
|
+
USCOUNTRY ||= "SYSGST/USCOUNTRY".freeze
|
25
|
+
USSTATE ||= "SYSGST/USSTATE".freeze
|
26
|
+
USCOUNTY ||= "SYSGST/USCOUNTY".freeze
|
27
|
+
USCITY ||= "SYSGST/USCITY".freeze
|
28
|
+
USSPECIAL ||= "SYSGST/USSPECIAL".freeze
|
29
|
+
|
30
|
+
# The name of the jurisdiction
|
31
|
+
attr_accessor :name
|
32
|
+
|
33
|
+
# The percentage of the tax
|
34
|
+
attr_accessor :tax_percentage
|
35
|
+
|
36
|
+
# The amount of the tax
|
37
|
+
attr_accessor :tax_amount
|
38
|
+
|
39
|
+
# The amount that is taxable
|
40
|
+
attr_accessor :taxable_amount
|
41
|
+
|
42
|
+
# The amount that is not taxable
|
43
|
+
attr_accessor :non_taxable_amount
|
44
|
+
|
45
|
+
# The amount that is exempt
|
46
|
+
attr_accessor :exempt_amount
|
47
|
+
|
48
|
+
# The state assigned number of the jurisdiction
|
49
|
+
attr_accessor :state_assigned_no
|
50
|
+
|
51
|
+
# Name identifying the region within the country
|
52
|
+
attr_accessor :jurisdiction_region
|
53
|
+
|
54
|
+
class EnumAttributeValidator
|
55
|
+
attr_reader :datatype
|
56
|
+
attr_reader :allowable_values
|
57
|
+
|
58
|
+
def initialize(datatype, allowable_values)
|
59
|
+
@allowable_values = allowable_values.map do |value|
|
60
|
+
case datatype.to_s
|
61
|
+
when /Integer/i
|
62
|
+
value.to_i
|
63
|
+
when /Float/i
|
64
|
+
value.to_f
|
65
|
+
else
|
66
|
+
value
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def valid?(value)
|
72
|
+
!value || allowable_values.include?(value)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
77
|
+
def self.attribute_map
|
78
|
+
{
|
79
|
+
:'tax_component_id' => :'TaxComponentId',
|
80
|
+
:'type' => :'Type',
|
81
|
+
:'name' => :'Name',
|
82
|
+
:'tax_percentage' => :'TaxPercentage',
|
83
|
+
:'tax_amount' => :'TaxAmount',
|
84
|
+
:'taxable_amount' => :'TaxableAmount',
|
85
|
+
:'non_taxable_amount' => :'NonTaxableAmount',
|
86
|
+
:'exempt_amount' => :'ExemptAmount',
|
87
|
+
:'state_assigned_no' => :'StateAssignedNo',
|
88
|
+
:'jurisdiction_region' => :'JurisdictionRegion'
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
# Attribute type mapping.
|
93
|
+
def self.openapi_types
|
94
|
+
{
|
95
|
+
:'tax_component_id' => :'String',
|
96
|
+
:'type' => :'String',
|
97
|
+
:'name' => :'String',
|
98
|
+
:'tax_percentage' => :'Float',
|
99
|
+
:'tax_amount' => :'Float',
|
100
|
+
:'taxable_amount' => :'Float',
|
101
|
+
:'non_taxable_amount' => :'Float',
|
102
|
+
:'exempt_amount' => :'Float',
|
103
|
+
:'state_assigned_no' => :'String',
|
104
|
+
:'jurisdiction_region' => :'String'
|
105
|
+
}
|
106
|
+
end
|
107
|
+
|
108
|
+
# Initializes the object
|
109
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
110
|
+
def initialize(attributes = {})
|
111
|
+
if (!attributes.is_a?(Hash))
|
112
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::TaxBreakdownComponent` initialize method"
|
113
|
+
end
|
114
|
+
|
115
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
116
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
117
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
118
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Accounting::TaxBreakdownComponent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
119
|
+
end
|
120
|
+
h[k.to_sym] = v
|
121
|
+
}
|
122
|
+
|
123
|
+
if attributes.key?(:'tax_component_id')
|
124
|
+
self.tax_component_id = attributes[:'tax_component_id']
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.key?(:'type')
|
128
|
+
self.type = attributes[:'type']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.key?(:'name')
|
132
|
+
self.name = attributes[:'name']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.key?(:'tax_percentage')
|
136
|
+
self.tax_percentage = attributes[:'tax_percentage']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.key?(:'tax_amount')
|
140
|
+
self.tax_amount = attributes[:'tax_amount']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.key?(:'taxable_amount')
|
144
|
+
self.taxable_amount = attributes[:'taxable_amount']
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.key?(:'non_taxable_amount')
|
148
|
+
self.non_taxable_amount = attributes[:'non_taxable_amount']
|
149
|
+
end
|
150
|
+
|
151
|
+
if attributes.key?(:'exempt_amount')
|
152
|
+
self.exempt_amount = attributes[:'exempt_amount']
|
153
|
+
end
|
154
|
+
|
155
|
+
if attributes.key?(:'state_assigned_no')
|
156
|
+
self.state_assigned_no = attributes[:'state_assigned_no']
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.key?(:'jurisdiction_region')
|
160
|
+
self.jurisdiction_region = attributes[:'jurisdiction_region']
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
165
|
+
# @return Array for valid properties with the reasons
|
166
|
+
def list_invalid_properties
|
167
|
+
invalid_properties = Array.new
|
168
|
+
invalid_properties
|
169
|
+
end
|
170
|
+
|
171
|
+
# Check to see if the all the properties in the model are valid
|
172
|
+
# @return true if the model is valid
|
173
|
+
def valid?
|
174
|
+
type_validator = EnumAttributeValidator.new('String', ["SYSGST/USCOUNTRY", "SYSGST/USSTATE", "SYSGST/USCOUNTY", "SYSGST/USCITY", "SYSGST/USSPECIAL"])
|
175
|
+
return false unless type_validator.valid?(@type)
|
176
|
+
true
|
177
|
+
end
|
178
|
+
|
179
|
+
# Custom attribute writer method checking allowed values (enum).
|
180
|
+
# @param [Object] type Object to be assigned
|
181
|
+
def type=(type)
|
182
|
+
validator = EnumAttributeValidator.new('String', ["SYSGST/USCOUNTRY", "SYSGST/USSTATE", "SYSGST/USCOUNTY", "SYSGST/USCITY", "SYSGST/USSPECIAL"])
|
183
|
+
unless validator.valid?(type)
|
184
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
185
|
+
end
|
186
|
+
@type = type
|
187
|
+
end
|
188
|
+
|
189
|
+
# Checks equality by comparing each attribute.
|
190
|
+
# @param [Object] Object to be compared
|
191
|
+
def ==(o)
|
192
|
+
return true if self.equal?(o)
|
193
|
+
self.class == o.class &&
|
194
|
+
tax_component_id == o.tax_component_id &&
|
195
|
+
type == o.type &&
|
196
|
+
name == o.name &&
|
197
|
+
tax_percentage == o.tax_percentage &&
|
198
|
+
tax_amount == o.tax_amount &&
|
199
|
+
taxable_amount == o.taxable_amount &&
|
200
|
+
non_taxable_amount == o.non_taxable_amount &&
|
201
|
+
exempt_amount == o.exempt_amount &&
|
202
|
+
state_assigned_no == o.state_assigned_no &&
|
203
|
+
jurisdiction_region == o.jurisdiction_region
|
204
|
+
end
|
205
|
+
|
206
|
+
# @see the `==` method
|
207
|
+
# @param [Object] Object to be compared
|
208
|
+
def eql?(o)
|
209
|
+
self == o
|
210
|
+
end
|
211
|
+
|
212
|
+
# Calculates hash code according to all attributes.
|
213
|
+
# @return [Integer] Hash code
|
214
|
+
def hash
|
215
|
+
[tax_component_id, type, name, tax_percentage, tax_amount, taxable_amount, non_taxable_amount, exempt_amount, state_assigned_no, jurisdiction_region].hash
|
216
|
+
end
|
217
|
+
|
218
|
+
# Builds the object from hash
|
219
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
220
|
+
# @return [Object] Returns the model itself
|
221
|
+
def self.build_from_hash(attributes)
|
222
|
+
new.build_from_hash(attributes)
|
223
|
+
end
|
224
|
+
|
225
|
+
# Builds the object from hash
|
226
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
227
|
+
# @return [Object] Returns the model itself
|
228
|
+
def build_from_hash(attributes)
|
229
|
+
return nil unless attributes.is_a?(Hash)
|
230
|
+
self.class.openapi_types.each_pair do |key, type|
|
231
|
+
if type =~ /\AArray<(.*)>/i
|
232
|
+
# check to ensure the input is an array given that the attribute
|
233
|
+
# is documented as an array but the input is not
|
234
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
235
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
236
|
+
end
|
237
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
238
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
239
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
240
|
+
end
|
241
|
+
|
242
|
+
self
|
243
|
+
end
|
244
|
+
|
245
|
+
# Deserializes the data based on type
|
246
|
+
# @param string type Data type
|
247
|
+
# @param string value Value to be deserialized
|
248
|
+
# @return [Object] Deserialized data
|
249
|
+
def _deserialize(type, value)
|
250
|
+
case type.to_sym
|
251
|
+
when :DateTime
|
252
|
+
DateTime.parse(parse_date(value))
|
253
|
+
when :Date
|
254
|
+
Date.parse(parse_date(value))
|
255
|
+
when :String
|
256
|
+
value.to_s
|
257
|
+
when :Integer
|
258
|
+
value.to_i
|
259
|
+
when :Float
|
260
|
+
value.to_f
|
261
|
+
when :BigDecimal
|
262
|
+
BigDecimal(value.to_s)
|
263
|
+
when :Boolean
|
264
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
265
|
+
true
|
266
|
+
else
|
267
|
+
false
|
268
|
+
end
|
269
|
+
when :Object
|
270
|
+
# generic object (usually a Hash), return directly
|
271
|
+
value
|
272
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
273
|
+
inner_type = Regexp.last_match[:inner_type]
|
274
|
+
value.map { |v| _deserialize(inner_type, v) }
|
275
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
276
|
+
k_type = Regexp.last_match[:k_type]
|
277
|
+
v_type = Regexp.last_match[:v_type]
|
278
|
+
{}.tap do |hash|
|
279
|
+
value.each do |k, v|
|
280
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
281
|
+
end
|
282
|
+
end
|
283
|
+
else # model
|
284
|
+
XeroRuby::Accounting.const_get(type).build_from_hash(value)
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
# Returns the string representation of the object
|
289
|
+
# @return [String] String presentation of the object
|
290
|
+
def to_s
|
291
|
+
to_hash.to_s
|
292
|
+
end
|
293
|
+
|
294
|
+
# to_body is an alias to to_hash (backward compatibility)
|
295
|
+
# @return [Hash] Returns the object in the form of hash
|
296
|
+
def to_body
|
297
|
+
to_hash
|
298
|
+
end
|
299
|
+
|
300
|
+
# Returns the object in the form of hash
|
301
|
+
# @return [Hash] Returns the object in the form of hash
|
302
|
+
def to_hash(downcase: false)
|
303
|
+
hash = {}
|
304
|
+
self.class.attribute_map.each_pair do |attr, param|
|
305
|
+
value = self.send(attr)
|
306
|
+
next if value.nil?
|
307
|
+
key = downcase ? attr : param
|
308
|
+
hash[key] = _to_hash(value, downcase: downcase)
|
309
|
+
end
|
310
|
+
hash
|
311
|
+
end
|
312
|
+
|
313
|
+
# Returns the object in the form of hash with snake_case
|
314
|
+
def to_attributes
|
315
|
+
to_hash(downcase: true)
|
316
|
+
end
|
317
|
+
|
318
|
+
# Outputs non-array value in the form of hash
|
319
|
+
# For object, use to_hash. Otherwise, just return the value
|
320
|
+
# @param [Object] value Any valid value
|
321
|
+
# @return [Hash] Returns the value in the form of hash
|
322
|
+
def _to_hash(value, downcase: false)
|
323
|
+
if value.is_a?(Array)
|
324
|
+
value.map do |v|
|
325
|
+
v.to_hash(downcase: downcase)
|
326
|
+
end
|
327
|
+
elsif value.is_a?(Hash)
|
328
|
+
{}.tap do |hash|
|
329
|
+
value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
|
330
|
+
end
|
331
|
+
elsif value.respond_to? :to_hash
|
332
|
+
value.to_hash(downcase: downcase)
|
333
|
+
else
|
334
|
+
value
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
def parse_date(datestring)
|
339
|
+
if datestring.include?('Date')
|
340
|
+
date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
|
341
|
+
original, date, timezone = *date_pattern.match(datestring)
|
342
|
+
date = (date.to_i / 1000)
|
343
|
+
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
344
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
345
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
346
|
+
else # handle date 'types' for small subset of payroll API's
|
347
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
348
|
+
end
|
349
|
+
end
|
350
|
+
end
|
351
|
+
end
|
@@ -112,10 +112,10 @@ module XeroRuby::Accounting
|
|
112
112
|
IGDSINPUT3 ||= "IGDSINPUT3".freeze
|
113
113
|
SROVR ||= "SROVR".freeze
|
114
114
|
TOURISTREFUND ||= "TOURISTREFUND".freeze
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
115
|
+
TXRCN33 ||= "TXRCN33".freeze
|
116
|
+
TXRCRE ||= "TXRCRE".freeze
|
117
|
+
TXRCESS ||= "TXRCESS".freeze
|
118
|
+
TXRCTS ||= "TXRCTS".freeze
|
119
119
|
CAPEXINPUT ||= "CAPEXINPUT".freeze
|
120
120
|
UNDEFINED ||= "UNDEFINED".freeze
|
121
121
|
CAPEXOUTPUT ||= "CAPEXOUTPUT".freeze
|
@@ -126,6 +126,13 @@ module XeroRuby::Accounting
|
|
126
126
|
SROVRRS ||= "SROVRRS".freeze
|
127
127
|
SROVRLVG ||= "SROVRLVG".freeze
|
128
128
|
SRLVG ||= "SRLVG".freeze
|
129
|
+
IM ||= "IM".freeze
|
130
|
+
IMESS ||= "IMESS".freeze
|
131
|
+
IMN33 ||= "IMN33".freeze
|
132
|
+
IMRE ||= "IMRE".freeze
|
133
|
+
BADDEBTRECOVERY ||= "BADDEBTRECOVERY".freeze
|
134
|
+
USSALESTAX ||= "USSALESTAX".freeze
|
135
|
+
BLINPUT3 ||= "BLINPUT3".freeze
|
129
136
|
|
130
137
|
# Boolean to describe if tax rate can be used for asset accounts i.e. true,false
|
131
138
|
attr_accessor :can_apply_to_assets
|
@@ -284,7 +291,7 @@ module XeroRuby::Accounting
|
|
284
291
|
def valid?
|
285
292
|
status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "DELETED", "ARCHIVED", "PENDING"])
|
286
293
|
return false unless status_validator.valid?(@status)
|
287
|
-
report_tax_type_validator = EnumAttributeValidator.new('String', ["AVALARA", "BASEXCLUDED", "CAPITALSALESOUTPUT", "CAPITALEXPENSESINPUT", "ECOUTPUT", "ECOUTPUTSERVICES", "ECINPUT", "ECACQUISITIONS", "EXEMPTEXPENSES", "EXEMPTINPUT", "EXEMPTOUTPUT", "GSTONIMPORTS", "INPUT", "INPUTTAXED", "MOSSSALES", "NONE", "NONEOUTPUT", "OUTPUT", "PURCHASESINPUT", "SALESOUTPUT", "EXEMPTCAPITAL", "EXEMPTEXPORT", "CAPITALEXINPUT", "GSTONCAPIMPORTS", "GSTONCAPITALIMPORTS", "REVERSECHARGES", "PAYMENTS", "INVOICE", "CASH", "ACCRUAL", "FLATRATECASH", "FLATRATEACCRUAL", "ACCRUALS", "TXCA", "SRCAS", "DSOUTPUT", "BLINPUT2", "EPINPUT", "IMINPUT2", "MEINPUT", "IGDSINPUT2", "ESN33OUTPUT", "OPINPUT", "OSOUTPUT", "TXN33INPUT", "TXESSINPUT", "TXREINPUT", "TXPETINPUT", "NRINPUT", "ES33OUTPUT", "ZERORATEDINPUT", "ZERORATEDOUTPUT", "DRCHARGESUPPLY", "DRCHARGE", "CAPINPUT", "CAPIMPORTS", "IMINPUT", "INPUT2", "CIUINPUT", "SRINPUT", "OUTPUT2", "SROUTPUT", "CAPOUTPUT", "SROUTPUT2", "CIUOUTPUT", "ZROUTPUT", "ZREXPORT", "ACC28PLUS", "ACCUPTO28", "OTHEROUTPUT", "SHOUTPUT", "ZRINPUT", "BADDEBT", "OTHERINPUT", "BADDEBTRELIEF", "IGDSINPUT3", "SROVR", "TOURISTREFUND", "
|
294
|
+
report_tax_type_validator = EnumAttributeValidator.new('String', ["AVALARA", "BASEXCLUDED", "CAPITALSALESOUTPUT", "CAPITALEXPENSESINPUT", "ECOUTPUT", "ECOUTPUTSERVICES", "ECINPUT", "ECACQUISITIONS", "EXEMPTEXPENSES", "EXEMPTINPUT", "EXEMPTOUTPUT", "GSTONIMPORTS", "INPUT", "INPUTTAXED", "MOSSSALES", "NONE", "NONEOUTPUT", "OUTPUT", "PURCHASESINPUT", "SALESOUTPUT", "EXEMPTCAPITAL", "EXEMPTEXPORT", "CAPITALEXINPUT", "GSTONCAPIMPORTS", "GSTONCAPITALIMPORTS", "REVERSECHARGES", "PAYMENTS", "INVOICE", "CASH", "ACCRUAL", "FLATRATECASH", "FLATRATEACCRUAL", "ACCRUALS", "TXCA", "SRCAS", "DSOUTPUT", "BLINPUT2", "EPINPUT", "IMINPUT2", "MEINPUT", "IGDSINPUT2", "ESN33OUTPUT", "OPINPUT", "OSOUTPUT", "TXN33INPUT", "TXESSINPUT", "TXREINPUT", "TXPETINPUT", "NRINPUT", "ES33OUTPUT", "ZERORATEDINPUT", "ZERORATEDOUTPUT", "DRCHARGESUPPLY", "DRCHARGE", "CAPINPUT", "CAPIMPORTS", "IMINPUT", "INPUT2", "CIUINPUT", "SRINPUT", "OUTPUT2", "SROUTPUT", "CAPOUTPUT", "SROUTPUT2", "CIUOUTPUT", "ZROUTPUT", "ZREXPORT", "ACC28PLUS", "ACCUPTO28", "OTHEROUTPUT", "SHOUTPUT", "ZRINPUT", "BADDEBT", "OTHERINPUT", "BADDEBTRELIEF", "IGDSINPUT3", "SROVR", "TOURISTREFUND", "TXRCN33", "TXRCRE", "TXRCESS", "TXRCTS", "CAPEXINPUT", "UNDEFINED", "CAPEXOUTPUT", "ZEROEXPOUTPUT", "GOODSIMPORT", "NONEINPUT", "NOTREPORTED", "SROVRRS", "SROVRLVG", "SRLVG", "IM", "IMESS", "IMN33", "IMRE", "BADDEBTRECOVERY", "USSALESTAX", "BLINPUT3"])
|
288
295
|
return false unless report_tax_type_validator.valid?(@report_tax_type)
|
289
296
|
true
|
290
297
|
end
|
@@ -302,7 +309,7 @@ module XeroRuby::Accounting
|
|
302
309
|
# Custom attribute writer method checking allowed values (enum).
|
303
310
|
# @param [Object] report_tax_type Object to be assigned
|
304
311
|
def report_tax_type=(report_tax_type)
|
305
|
-
validator = EnumAttributeValidator.new('String', ["AVALARA", "BASEXCLUDED", "CAPITALSALESOUTPUT", "CAPITALEXPENSESINPUT", "ECOUTPUT", "ECOUTPUTSERVICES", "ECINPUT", "ECACQUISITIONS", "EXEMPTEXPENSES", "EXEMPTINPUT", "EXEMPTOUTPUT", "GSTONIMPORTS", "INPUT", "INPUTTAXED", "MOSSSALES", "NONE", "NONEOUTPUT", "OUTPUT", "PURCHASESINPUT", "SALESOUTPUT", "EXEMPTCAPITAL", "EXEMPTEXPORT", "CAPITALEXINPUT", "GSTONCAPIMPORTS", "GSTONCAPITALIMPORTS", "REVERSECHARGES", "PAYMENTS", "INVOICE", "CASH", "ACCRUAL", "FLATRATECASH", "FLATRATEACCRUAL", "ACCRUALS", "TXCA", "SRCAS", "DSOUTPUT", "BLINPUT2", "EPINPUT", "IMINPUT2", "MEINPUT", "IGDSINPUT2", "ESN33OUTPUT", "OPINPUT", "OSOUTPUT", "TXN33INPUT", "TXESSINPUT", "TXREINPUT", "TXPETINPUT", "NRINPUT", "ES33OUTPUT", "ZERORATEDINPUT", "ZERORATEDOUTPUT", "DRCHARGESUPPLY", "DRCHARGE", "CAPINPUT", "CAPIMPORTS", "IMINPUT", "INPUT2", "CIUINPUT", "SRINPUT", "OUTPUT2", "SROUTPUT", "CAPOUTPUT", "SROUTPUT2", "CIUOUTPUT", "ZROUTPUT", "ZREXPORT", "ACC28PLUS", "ACCUPTO28", "OTHEROUTPUT", "SHOUTPUT", "ZRINPUT", "BADDEBT", "OTHERINPUT", "BADDEBTRELIEF", "IGDSINPUT3", "SROVR", "TOURISTREFUND", "
|
312
|
+
validator = EnumAttributeValidator.new('String', ["AVALARA", "BASEXCLUDED", "CAPITALSALESOUTPUT", "CAPITALEXPENSESINPUT", "ECOUTPUT", "ECOUTPUTSERVICES", "ECINPUT", "ECACQUISITIONS", "EXEMPTEXPENSES", "EXEMPTINPUT", "EXEMPTOUTPUT", "GSTONIMPORTS", "INPUT", "INPUTTAXED", "MOSSSALES", "NONE", "NONEOUTPUT", "OUTPUT", "PURCHASESINPUT", "SALESOUTPUT", "EXEMPTCAPITAL", "EXEMPTEXPORT", "CAPITALEXINPUT", "GSTONCAPIMPORTS", "GSTONCAPITALIMPORTS", "REVERSECHARGES", "PAYMENTS", "INVOICE", "CASH", "ACCRUAL", "FLATRATECASH", "FLATRATEACCRUAL", "ACCRUALS", "TXCA", "SRCAS", "DSOUTPUT", "BLINPUT2", "EPINPUT", "IMINPUT2", "MEINPUT", "IGDSINPUT2", "ESN33OUTPUT", "OPINPUT", "OSOUTPUT", "TXN33INPUT", "TXESSINPUT", "TXREINPUT", "TXPETINPUT", "NRINPUT", "ES33OUTPUT", "ZERORATEDINPUT", "ZERORATEDOUTPUT", "DRCHARGESUPPLY", "DRCHARGE", "CAPINPUT", "CAPIMPORTS", "IMINPUT", "INPUT2", "CIUINPUT", "SRINPUT", "OUTPUT2", "SROUTPUT", "CAPOUTPUT", "SROUTPUT2", "CIUOUTPUT", "ZROUTPUT", "ZREXPORT", "ACC28PLUS", "ACCUPTO28", "OTHEROUTPUT", "SHOUTPUT", "ZRINPUT", "BADDEBT", "OTHERINPUT", "BADDEBTRELIEF", "IGDSINPUT3", "SROVR", "TOURISTREFUND", "TXRCN33", "TXRCRE", "TXRCESS", "TXRCTS", "CAPEXINPUT", "UNDEFINED", "CAPEXOUTPUT", "ZEROEXPOUTPUT", "GOODSIMPORT", "NONEINPUT", "NOTREPORTED", "SROVRRS", "SROVRLVG", "SRLVG", "IM", "IMESS", "IMN33", "IMRE", "BADDEBTRECOVERY", "USSALESTAX", "BLINPUT3"])
|
306
313
|
unless validator.valid?(report_tax_type)
|
307
314
|
fail ArgumentError, "invalid value for \"report_tax_type\", must be one of #{validator.allowable_values}."
|
308
315
|
end
|
@@ -77,10 +77,10 @@ module XeroRuby::Accounting
|
|
77
77
|
IGDSINPUT3 ||= "IGDSINPUT3".freeze
|
78
78
|
SROVR ||= "SROVR".freeze
|
79
79
|
TOURISTREFUND ||= "TOURISTREFUND".freeze
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
80
|
+
TXRCN33 ||= "TXRCN33".freeze
|
81
|
+
TXRCRE ||= "TXRCRE".freeze
|
82
|
+
TXRCESS ||= "TXRCESS".freeze
|
83
|
+
TXRCTS ||= "TXRCTS".freeze
|
84
84
|
OUTPUTY23 ||= "OUTPUTY23".freeze
|
85
85
|
DSOUTPUTY23 ||= "DSOUTPUTY23".freeze
|
86
86
|
INPUTY23 ||= "INPUTY23".freeze
|
@@ -96,6 +96,47 @@ module XeroRuby::Accounting
|
|
96
96
|
SROVRRSY23 ||= "SROVRRSY23".freeze
|
97
97
|
SROVRLVGY23 ||= "SROVRLVGY23".freeze
|
98
98
|
SRLVGY23 ||= "SRLVGY23".freeze
|
99
|
+
TXRCN33_Y23 ||= "TXRCN33Y23".freeze
|
100
|
+
TXRCREY23 ||= "TXRCREY23".freeze
|
101
|
+
TXRCESSY23 ||= "TXRCESSY23".freeze
|
102
|
+
TXRCTSY23 ||= "TXRCTSY23".freeze
|
103
|
+
IM ||= "IM".freeze
|
104
|
+
IMY23 ||= "IMY23".freeze
|
105
|
+
IMESS ||= "IMESS".freeze
|
106
|
+
IMESSY23 ||= "IMESSY23".freeze
|
107
|
+
IMN33 ||= "IMN33".freeze
|
108
|
+
IMN33_Y23 ||= "IMN33Y23".freeze
|
109
|
+
IMRE ||= "IMRE".freeze
|
110
|
+
IMREY23 ||= "IMREY23".freeze
|
111
|
+
BADDEBTRECOVERY ||= "BADDEBTRECOVERY".freeze
|
112
|
+
BADDEBTRECOVERYY23 ||= "BADDEBTRECOVERYY23".freeze
|
113
|
+
OUTPUTY24 ||= "OUTPUTY24".freeze
|
114
|
+
DSOUTPUTY24 ||= "DSOUTPUTY24".freeze
|
115
|
+
INPUTY24 ||= "INPUTY24".freeze
|
116
|
+
IGDSINPUT2_Y24 ||= "IGDSINPUT2Y24".freeze
|
117
|
+
TXPETINPUTY24 ||= "TXPETINPUTY24".freeze
|
118
|
+
TXESSINPUTY24 ||= "TXESSINPUTY24".freeze
|
119
|
+
TXN33_INPUTY24 ||= "TXN33INPUTY24".freeze
|
120
|
+
TXREINPUTY24 ||= "TXREINPUTY24".freeze
|
121
|
+
TXCAY24 ||= "TXCAY24".freeze
|
122
|
+
BADDEBTRELIEFY24 ||= "BADDEBTRELIEFY24".freeze
|
123
|
+
IGDSINPUT3_Y24 ||= "IGDSINPUT3Y24".freeze
|
124
|
+
SROVRRSY24 ||= "SROVRRSY24".freeze
|
125
|
+
SROVRLVGY24 ||= "SROVRLVGY24".freeze
|
126
|
+
SRLVGY24 ||= "SRLVGY24".freeze
|
127
|
+
TXRCTSY24 ||= "TXRCTSY24".freeze
|
128
|
+
TXRCESSY24 ||= "TXRCESSY24".freeze
|
129
|
+
TXRCN33_Y24 ||= "TXRCN33Y24".freeze
|
130
|
+
TXRCREY24 ||= "TXRCREY24".freeze
|
131
|
+
IMY24 ||= "IMY24".freeze
|
132
|
+
IMESSY24 ||= "IMESSY24".freeze
|
133
|
+
IMN33_Y24 ||= "IMN33Y24".freeze
|
134
|
+
IMREY24 ||= "IMREY24".freeze
|
135
|
+
BADDEBTRECOVERYY24 ||= "BADDEBTRECOVERYY24".freeze
|
136
|
+
OSOUTPUT2 ||= "OSOUTPUT2".freeze
|
137
|
+
BLINPUT3 ||= "BLINPUT3".freeze
|
138
|
+
BLINPUT3_Y23 ||= "BLINPUT3Y23".freeze
|
139
|
+
BLINPUT3_Y24 ||= "BLINPUT3Y24".freeze
|
99
140
|
|
100
141
|
# Builds the enum from string
|
101
142
|
# @param [String] The enum value in the form of the string
|