xero-ruby 9.3.0 → 18.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 +178 -319
- data/lib/xero-ruby/api/files_api.rb +9 -2
- data/lib/xero-ruby/api/finance_api.rb +0 -299
- data/lib/xero-ruby/api/payroll_au_v2_api.rb +751 -0
- data/lib/xero-ruby/api/payroll_nz_api.rb +0 -86
- data/lib/xero-ruby/api/payroll_uk_api.rb +0 -86
- data/lib/xero-ruby/models/accounting/bank_transfer.rb +71 -1
- data/lib/xero-ruby/models/accounting/bank_transfer_delete.rb +244 -0
- data/lib/xero-ruby/models/accounting/bank_transfer_delete_by_url_param.rb +229 -0
- data/lib/xero-ruby/models/accounting/bank_transfers_delete.rb +224 -0
- data/lib/xero-ruby/models/accounting/contact.rb +27 -1
- data/lib/xero-ruby/models/accounting/credit_note.rb +11 -1
- data/lib/xero-ruby/models/accounting/invoice.rb +12 -2
- data/lib/xero-ruby/models/accounting/organisation.rb +25 -6
- data/lib/xero-ruby/models/accounting/overpayment.rb +21 -1
- data/lib/xero-ruby/models/accounting/payment.rb +11 -1
- data/lib/xero-ruby/models/accounting/prepayment.rb +31 -1
- data/lib/xero-ruby/models/accounting/tracking_reference.rb +277 -0
- data/lib/xero-ruby/models/accounting/user.rb +3 -2
- data/lib/xero-ruby/models/app_store/product.rb +4 -3
- data/lib/xero-ruby/models/assets/book_depreciation_detail.rb +54 -4
- data/lib/xero-ruby/models/files/association.rb +21 -1
- data/lib/xero-ruby/models/finance/current_statement_response.rb +1 -1
- data/lib/xero-ruby/models/finance/data_source_response.rb +1 -31
- data/lib/xero-ruby/models/payroll_au/earnings_rate.rb +16 -1
- data/lib/xero-ruby/models/payroll_au/employee.rb +1 -13
- data/lib/xero-ruby/models/payroll_au/leave_line.rb +16 -1
- data/lib/xero-ruby/models/payroll_au/leave_type.rb +19 -4
- data/lib/xero-ruby/models/payroll_au/opening_balance_leave_line.rb +232 -0
- data/lib/xero-ruby/models/payroll_au/opening_balances.rb +1 -1
- data/lib/xero-ruby/models/payroll_au/tax_declaration.rb +14 -4
- data/lib/xero-ruby/models/payroll_au_v2/invalid_field.rb +232 -0
- data/lib/xero-ruby/models/payroll_au_v2/pagination.rb +252 -0
- data/lib/xero-ruby/models/payroll_au_v2/problem.rb +275 -0
- data/lib/xero-ruby/models/payroll_au_v2/timesheet.rb +361 -0
- data/lib/xero-ruby/models/payroll_au_v2/timesheet_line.rb +277 -0
- data/lib/xero-ruby/models/payroll_au_v2/timesheet_line_object.rb +242 -0
- data/lib/xero-ruby/models/payroll_au_v2/timesheet_object.rb +242 -0
- data/lib/xero-ruby/models/payroll_au_v2/timesheets.rb +244 -0
- data/lib/xero-ruby/models/payroll_nz/employee.rb +20 -0
- data/lib/xero-ruby/models/payroll_nz/employee_leave_setup.rb +29 -19
- data/lib/xero-ruby/models/payroll_nz/employee_leave_type.rb +31 -11
- data/lib/xero-ruby/models/payroll_nz/employee_pay_template.rb +5 -0
- data/lib/xero-ruby/models/payroll_nz/employment.rb +15 -0
- 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_uk/contract_type.rb +38 -0
- data/lib/xero-ruby/models/payroll_uk/contracts.rb +297 -0
- data/lib/xero-ruby/models/payroll_uk/developmental_role_details.rb +267 -0
- data/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +5 -2
- data/lib/xero-ruby/models/payroll_uk/employee.rb +68 -4
- data/lib/xero-ruby/models/payroll_uk/employee_pay_template.rb +5 -0
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_balance.rb +4 -2
- data/lib/xero-ruby/models/payroll_uk/employee_statutory_leave_summary.rb +5 -2
- data/lib/xero-ruby/models/payroll_uk/employment.rb +49 -52
- data/lib/xero-ruby/models/payroll_uk/employment_status.rb +37 -0
- data/lib/xero-ruby/models/payroll_uk/ni_category.rb +318 -0
- data/lib/xero-ruby/models/payroll_uk/ni_category_letter.rb +51 -0
- data/lib/xero-ruby/models/payroll_uk/ni_category_one_of.rb +264 -0
- data/lib/xero-ruby/models/payroll_uk/ni_category_one_of1.rb +257 -0
- data/lib/xero-ruby/version.rb +2 -2
- data/lib/xero-ruby.rb +22 -10
- data/spec/finance/api/finance_api_spec.rb +0 -53
- metadata +393 -391
- data/spec/finance/models/account_usage_response_spec.rb +0 -58
- data/spec/finance/models/account_usage_spec.rb +0 -112
- data/spec/finance/models/history_record_response_spec.rb +0 -64
- data/spec/finance/models/lock_history_model_spec.rb +0 -52
- data/spec/finance/models/lock_history_response_spec.rb +0 -52
- data/spec/finance/models/practice_response_spec.rb +0 -64
- data/spec/finance/models/report_history_model_spec.rb +0 -52
- data/spec/finance/models/report_history_response_spec.rb +0 -52
- data/spec/finance/models/user_activities_response_spec.rb +0 -52
- data/spec/finance/models/user_response_spec.rb +0 -106
|
@@ -0,0 +1,229 @@
|
|
|
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 BankTransferDeleteByUrlParam
|
|
19
|
+
# The status of the bank transfer.
|
|
20
|
+
attr_accessor :status
|
|
21
|
+
|
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
23
|
+
def self.attribute_map
|
|
24
|
+
{
|
|
25
|
+
:'status' => :'Status'
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Attribute type mapping.
|
|
30
|
+
def self.openapi_types
|
|
31
|
+
{
|
|
32
|
+
:'status' => :'String'
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Initializes the object
|
|
37
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
38
|
+
def initialize(attributes = {})
|
|
39
|
+
if (!attributes.is_a?(Hash))
|
|
40
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::BankTransferDeleteByUrlParam` initialize method"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
44
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
45
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
46
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Accounting::BankTransferDeleteByUrlParam`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
47
|
+
end
|
|
48
|
+
h[k.to_sym] = v
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if attributes.key?(:'status')
|
|
52
|
+
self.status = attributes[:'status']
|
|
53
|
+
else
|
|
54
|
+
self.status = 'DELETED'
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
59
|
+
# @return Array for valid properties with the reasons
|
|
60
|
+
def list_invalid_properties
|
|
61
|
+
invalid_properties = Array.new
|
|
62
|
+
if @status.nil?
|
|
63
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
invalid_properties
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Check to see if the all the properties in the model are valid
|
|
70
|
+
# @return true if the model is valid
|
|
71
|
+
def valid?
|
|
72
|
+
return false if @status.nil?
|
|
73
|
+
true
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Checks equality by comparing each attribute.
|
|
77
|
+
# @param [Object] Object to be compared
|
|
78
|
+
def ==(o)
|
|
79
|
+
return true if self.equal?(o)
|
|
80
|
+
self.class == o.class &&
|
|
81
|
+
status == o.status
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# @see the `==` method
|
|
85
|
+
# @param [Object] Object to be compared
|
|
86
|
+
def eql?(o)
|
|
87
|
+
self == o
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Calculates hash code according to all attributes.
|
|
91
|
+
# @return [Integer] Hash code
|
|
92
|
+
def hash
|
|
93
|
+
[status].hash
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Builds the object from hash
|
|
97
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
98
|
+
# @return [Object] Returns the model itself
|
|
99
|
+
def self.build_from_hash(attributes)
|
|
100
|
+
new.build_from_hash(attributes)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Builds the object from hash
|
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
105
|
+
# @return [Object] Returns the model itself
|
|
106
|
+
def build_from_hash(attributes)
|
|
107
|
+
return nil unless attributes.is_a?(Hash)
|
|
108
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
109
|
+
if type =~ /\AArray<(.*)>/i
|
|
110
|
+
# check to ensure the input is an array given that the attribute
|
|
111
|
+
# is documented as an array but the input is not
|
|
112
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
113
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
114
|
+
end
|
|
115
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
116
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
117
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
self
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Deserializes the data based on type
|
|
124
|
+
# @param string type Data type
|
|
125
|
+
# @param string value Value to be deserialized
|
|
126
|
+
# @return [Object] Deserialized data
|
|
127
|
+
def _deserialize(type, value)
|
|
128
|
+
case type.to_sym
|
|
129
|
+
when :DateTime
|
|
130
|
+
DateTime.parse(parse_date(value))
|
|
131
|
+
when :Date
|
|
132
|
+
Date.parse(parse_date(value))
|
|
133
|
+
when :String
|
|
134
|
+
value.to_s
|
|
135
|
+
when :Integer
|
|
136
|
+
value.to_i
|
|
137
|
+
when :Float
|
|
138
|
+
value.to_f
|
|
139
|
+
when :BigDecimal
|
|
140
|
+
BigDecimal(value.to_s)
|
|
141
|
+
when :Boolean
|
|
142
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
143
|
+
true
|
|
144
|
+
else
|
|
145
|
+
false
|
|
146
|
+
end
|
|
147
|
+
when :Object
|
|
148
|
+
# generic object (usually a Hash), return directly
|
|
149
|
+
value
|
|
150
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
151
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
152
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
153
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
154
|
+
k_type = Regexp.last_match[:k_type]
|
|
155
|
+
v_type = Regexp.last_match[:v_type]
|
|
156
|
+
{}.tap do |hash|
|
|
157
|
+
value.each do |k, v|
|
|
158
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
else # model
|
|
162
|
+
XeroRuby::Accounting.const_get(type).build_from_hash(value)
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Returns the string representation of the object
|
|
167
|
+
# @return [String] String presentation of the object
|
|
168
|
+
def to_s
|
|
169
|
+
to_hash.to_s
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
173
|
+
# @return [Hash] Returns the object in the form of hash
|
|
174
|
+
def to_body
|
|
175
|
+
to_hash
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Returns the object in the form of hash
|
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
|
180
|
+
def to_hash(downcase: false)
|
|
181
|
+
hash = {}
|
|
182
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
183
|
+
value = self.send(attr)
|
|
184
|
+
next if value.nil?
|
|
185
|
+
key = downcase ? attr : param
|
|
186
|
+
hash[key] = _to_hash(value, downcase: downcase)
|
|
187
|
+
end
|
|
188
|
+
hash
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Returns the object in the form of hash with snake_case
|
|
192
|
+
def to_attributes
|
|
193
|
+
to_hash(downcase: true)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Outputs non-array value in the form of hash
|
|
197
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
198
|
+
# @param [Object] value Any valid value
|
|
199
|
+
# @return [Hash] Returns the value in the form of hash
|
|
200
|
+
def _to_hash(value, downcase: false)
|
|
201
|
+
if value.is_a?(Array)
|
|
202
|
+
value.map do |v|
|
|
203
|
+
v.to_hash(downcase: downcase)
|
|
204
|
+
end
|
|
205
|
+
elsif value.is_a?(Hash)
|
|
206
|
+
{}.tap do |hash|
|
|
207
|
+
value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
|
|
208
|
+
end
|
|
209
|
+
elsif value.respond_to? :to_hash
|
|
210
|
+
value.to_hash(downcase: downcase)
|
|
211
|
+
else
|
|
212
|
+
value
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def parse_date(datestring)
|
|
217
|
+
if datestring.include?('Date')
|
|
218
|
+
date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
|
|
219
|
+
original, date, timezone = *date_pattern.match(datestring)
|
|
220
|
+
date = (date.to_i / 1000)
|
|
221
|
+
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
222
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
223
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
224
|
+
else # handle date 'types' for small subset of payroll API's
|
|
225
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
end
|
|
@@ -0,0 +1,224 @@
|
|
|
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 BankTransfersDelete
|
|
19
|
+
|
|
20
|
+
attr_accessor :bank_transfers
|
|
21
|
+
|
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
23
|
+
def self.attribute_map
|
|
24
|
+
{
|
|
25
|
+
:'bank_transfers' => :'BankTransfers'
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Attribute type mapping.
|
|
30
|
+
def self.openapi_types
|
|
31
|
+
{
|
|
32
|
+
:'bank_transfers' => :'Array<BankTransferDelete>'
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Initializes the object
|
|
37
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
38
|
+
def initialize(attributes = {})
|
|
39
|
+
if (!attributes.is_a?(Hash))
|
|
40
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::BankTransfersDelete` initialize method"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
44
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
45
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
46
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Accounting::BankTransfersDelete`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
47
|
+
end
|
|
48
|
+
h[k.to_sym] = v
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if attributes.key?(:'bank_transfers')
|
|
52
|
+
if (value = attributes[:'bank_transfers']).is_a?(Array)
|
|
53
|
+
self.bank_transfers = value
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
59
|
+
# @return Array for valid properties with the reasons
|
|
60
|
+
def list_invalid_properties
|
|
61
|
+
invalid_properties = Array.new
|
|
62
|
+
invalid_properties
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Check to see if the all the properties in the model are valid
|
|
66
|
+
# @return true if the model is valid
|
|
67
|
+
def valid?
|
|
68
|
+
true
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Checks equality by comparing each attribute.
|
|
72
|
+
# @param [Object] Object to be compared
|
|
73
|
+
def ==(o)
|
|
74
|
+
return true if self.equal?(o)
|
|
75
|
+
self.class == o.class &&
|
|
76
|
+
bank_transfers == o.bank_transfers
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# @see the `==` method
|
|
80
|
+
# @param [Object] Object to be compared
|
|
81
|
+
def eql?(o)
|
|
82
|
+
self == o
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Calculates hash code according to all attributes.
|
|
86
|
+
# @return [Integer] Hash code
|
|
87
|
+
def hash
|
|
88
|
+
[bank_transfers].hash
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Builds the object from hash
|
|
92
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
93
|
+
# @return [Object] Returns the model itself
|
|
94
|
+
def self.build_from_hash(attributes)
|
|
95
|
+
new.build_from_hash(attributes)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Builds the object from hash
|
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
100
|
+
# @return [Object] Returns the model itself
|
|
101
|
+
def build_from_hash(attributes)
|
|
102
|
+
return nil unless attributes.is_a?(Hash)
|
|
103
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
104
|
+
if type =~ /\AArray<(.*)>/i
|
|
105
|
+
# check to ensure the input is an array given that the attribute
|
|
106
|
+
# is documented as an array but the input is not
|
|
107
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
108
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
109
|
+
end
|
|
110
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
111
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
112
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
self
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Deserializes the data based on type
|
|
119
|
+
# @param string type Data type
|
|
120
|
+
# @param string value Value to be deserialized
|
|
121
|
+
# @return [Object] Deserialized data
|
|
122
|
+
def _deserialize(type, value)
|
|
123
|
+
case type.to_sym
|
|
124
|
+
when :DateTime
|
|
125
|
+
DateTime.parse(parse_date(value))
|
|
126
|
+
when :Date
|
|
127
|
+
Date.parse(parse_date(value))
|
|
128
|
+
when :String
|
|
129
|
+
value.to_s
|
|
130
|
+
when :Integer
|
|
131
|
+
value.to_i
|
|
132
|
+
when :Float
|
|
133
|
+
value.to_f
|
|
134
|
+
when :BigDecimal
|
|
135
|
+
BigDecimal(value.to_s)
|
|
136
|
+
when :Boolean
|
|
137
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
138
|
+
true
|
|
139
|
+
else
|
|
140
|
+
false
|
|
141
|
+
end
|
|
142
|
+
when :Object
|
|
143
|
+
# generic object (usually a Hash), return directly
|
|
144
|
+
value
|
|
145
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
146
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
147
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
148
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
149
|
+
k_type = Regexp.last_match[:k_type]
|
|
150
|
+
v_type = Regexp.last_match[:v_type]
|
|
151
|
+
{}.tap do |hash|
|
|
152
|
+
value.each do |k, v|
|
|
153
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
else # model
|
|
157
|
+
XeroRuby::Accounting.const_get(type).build_from_hash(value)
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Returns the string representation of the object
|
|
162
|
+
# @return [String] String presentation of the object
|
|
163
|
+
def to_s
|
|
164
|
+
to_hash.to_s
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
|
169
|
+
def to_body
|
|
170
|
+
to_hash
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Returns the object in the form of hash
|
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
|
175
|
+
def to_hash(downcase: false)
|
|
176
|
+
hash = {}
|
|
177
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
178
|
+
value = self.send(attr)
|
|
179
|
+
next if value.nil?
|
|
180
|
+
key = downcase ? attr : param
|
|
181
|
+
hash[key] = _to_hash(value, downcase: downcase)
|
|
182
|
+
end
|
|
183
|
+
hash
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# Returns the object in the form of hash with snake_case
|
|
187
|
+
def to_attributes
|
|
188
|
+
to_hash(downcase: true)
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Outputs non-array value in the form of hash
|
|
192
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
193
|
+
# @param [Object] value Any valid value
|
|
194
|
+
# @return [Hash] Returns the value in the form of hash
|
|
195
|
+
def _to_hash(value, downcase: false)
|
|
196
|
+
if value.is_a?(Array)
|
|
197
|
+
value.map do |v|
|
|
198
|
+
v.to_hash(downcase: downcase)
|
|
199
|
+
end
|
|
200
|
+
elsif value.is_a?(Hash)
|
|
201
|
+
{}.tap do |hash|
|
|
202
|
+
value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
|
|
203
|
+
end
|
|
204
|
+
elsif value.respond_to? :to_hash
|
|
205
|
+
value.to_hash(downcase: downcase)
|
|
206
|
+
else
|
|
207
|
+
value
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def parse_date(datestring)
|
|
212
|
+
if datestring.include?('Date')
|
|
213
|
+
date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
|
|
214
|
+
original, date, timezone = *date_pattern.match(datestring)
|
|
215
|
+
date = (date.to_i / 1000)
|
|
216
|
+
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
|
217
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
|
218
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
219
|
+
else # handle date 'types' for small subset of payroll API's
|
|
220
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
end
|
|
@@ -58,6 +58,13 @@ module XeroRuby::Accounting
|
|
|
58
58
|
# Tax number of contact – this is also known as the ABN (Australia), GST Number (New Zealand), VAT Number (UK) or Tax ID Number (US and global) in the Xero UI depending on which regionalized version of Xero you are using (max length = 50)
|
|
59
59
|
attr_accessor :tax_number
|
|
60
60
|
|
|
61
|
+
# Identifier of the regional type of tax number, such as US, UK, or other regional tax identifiers
|
|
62
|
+
attr_accessor :tax_number_type
|
|
63
|
+
SSN ||= "SSN".freeze
|
|
64
|
+
EIN ||= "EIN".freeze
|
|
65
|
+
ITIN ||= "ITIN".freeze
|
|
66
|
+
ATIN ||= "ATIN".freeze
|
|
67
|
+
|
|
61
68
|
# The tax type from TaxRates
|
|
62
69
|
attr_accessor :accounts_receivable_tax_type
|
|
63
70
|
|
|
@@ -189,6 +196,7 @@ module XeroRuby::Accounting
|
|
|
189
196
|
:'contact_persons' => :'ContactPersons',
|
|
190
197
|
:'bank_account_details' => :'BankAccountDetails',
|
|
191
198
|
:'tax_number' => :'TaxNumber',
|
|
199
|
+
:'tax_number_type' => :'TaxNumberType',
|
|
192
200
|
:'accounts_receivable_tax_type' => :'AccountsReceivableTaxType',
|
|
193
201
|
:'accounts_payable_tax_type' => :'AccountsPayableTaxType',
|
|
194
202
|
:'addresses' => :'Addresses',
|
|
@@ -237,6 +245,7 @@ module XeroRuby::Accounting
|
|
|
237
245
|
:'contact_persons' => :'Array<ContactPerson>',
|
|
238
246
|
:'bank_account_details' => :'String',
|
|
239
247
|
:'tax_number' => :'String',
|
|
248
|
+
:'tax_number_type' => :'String',
|
|
240
249
|
:'accounts_receivable_tax_type' => :'String',
|
|
241
250
|
:'accounts_payable_tax_type' => :'String',
|
|
242
251
|
:'addresses' => :'Array<Address>',
|
|
@@ -338,6 +347,10 @@ module XeroRuby::Accounting
|
|
|
338
347
|
self.tax_number = attributes[:'tax_number']
|
|
339
348
|
end
|
|
340
349
|
|
|
350
|
+
if attributes.key?(:'tax_number_type')
|
|
351
|
+
self.tax_number_type = attributes[:'tax_number_type']
|
|
352
|
+
end
|
|
353
|
+
|
|
341
354
|
if attributes.key?(:'accounts_receivable_tax_type')
|
|
342
355
|
self.accounts_receivable_tax_type = attributes[:'accounts_receivable_tax_type']
|
|
343
356
|
end
|
|
@@ -525,6 +538,8 @@ module XeroRuby::Accounting
|
|
|
525
538
|
return false if !@company_number.nil? && @company_number.to_s.length > 50
|
|
526
539
|
return false if !@email_address.nil? && @email_address.to_s.length > 255
|
|
527
540
|
return false if !@tax_number.nil? && @tax_number.to_s.length > 50
|
|
541
|
+
tax_number_type_validator = EnumAttributeValidator.new('String', ["SSN", "EIN", "ITIN", "ATIN"])
|
|
542
|
+
return false unless tax_number_type_validator.valid?(@tax_number_type)
|
|
528
543
|
sales_default_line_amount_type_validator = EnumAttributeValidator.new('String', ["INCLUSIVE", "EXCLUSIVE", "NONE"])
|
|
529
544
|
return false unless sales_default_line_amount_type_validator.valid?(@sales_default_line_amount_type)
|
|
530
545
|
purchases_default_line_amount_type_validator = EnumAttributeValidator.new('String', ["INCLUSIVE", "EXCLUSIVE", "NONE"])
|
|
@@ -622,6 +637,16 @@ module XeroRuby::Accounting
|
|
|
622
637
|
@tax_number = tax_number
|
|
623
638
|
end
|
|
624
639
|
|
|
640
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
641
|
+
# @param [Object] tax_number_type Object to be assigned
|
|
642
|
+
def tax_number_type=(tax_number_type)
|
|
643
|
+
validator = EnumAttributeValidator.new('String', ["SSN", "EIN", "ITIN", "ATIN"])
|
|
644
|
+
unless validator.valid?(tax_number_type)
|
|
645
|
+
fail ArgumentError, "invalid value for \"tax_number_type\", must be one of #{validator.allowable_values}."
|
|
646
|
+
end
|
|
647
|
+
@tax_number_type = tax_number_type
|
|
648
|
+
end
|
|
649
|
+
|
|
625
650
|
# Custom attribute writer method checking allowed values (enum).
|
|
626
651
|
# @param [Object] sales_default_line_amount_type Object to be assigned
|
|
627
652
|
def sales_default_line_amount_type=(sales_default_line_amount_type)
|
|
@@ -660,6 +685,7 @@ module XeroRuby::Accounting
|
|
|
660
685
|
contact_persons == o.contact_persons &&
|
|
661
686
|
bank_account_details == o.bank_account_details &&
|
|
662
687
|
tax_number == o.tax_number &&
|
|
688
|
+
tax_number_type == o.tax_number_type &&
|
|
663
689
|
accounts_receivable_tax_type == o.accounts_receivable_tax_type &&
|
|
664
690
|
accounts_payable_tax_type == o.accounts_payable_tax_type &&
|
|
665
691
|
addresses == o.addresses &&
|
|
@@ -700,7 +726,7 @@ module XeroRuby::Accounting
|
|
|
700
726
|
# Calculates hash code according to all attributes.
|
|
701
727
|
# @return [Integer] Hash code
|
|
702
728
|
def hash
|
|
703
|
-
[contact_id, merged_to_contact_id, contact_number, account_number, contact_status, name, first_name, last_name, company_number, email_address, contact_persons, bank_account_details, tax_number, accounts_receivable_tax_type, accounts_payable_tax_type, addresses, phones, is_supplier, is_customer, sales_default_line_amount_type, purchases_default_line_amount_type, default_currency, xero_network_key, sales_default_account_code, purchases_default_account_code, sales_tracking_categories, purchases_tracking_categories, tracking_category_name, tracking_category_option, payment_terms, updated_date_utc, contact_groups, website, branding_theme, batch_payments, discount, balances, attachments, has_attachments, validation_errors, has_validation_errors, status_attribute_string].hash
|
|
729
|
+
[contact_id, merged_to_contact_id, contact_number, account_number, contact_status, name, first_name, last_name, company_number, email_address, contact_persons, bank_account_details, tax_number, tax_number_type, accounts_receivable_tax_type, accounts_payable_tax_type, addresses, phones, is_supplier, is_customer, sales_default_line_amount_type, purchases_default_line_amount_type, default_currency, xero_network_key, sales_default_account_code, purchases_default_account_code, sales_tracking_categories, purchases_tracking_categories, tracking_category_name, tracking_category_option, payment_terms, updated_date_utc, contact_groups, website, branding_theme, batch_payments, discount, balances, attachments, has_attachments, validation_errors, has_validation_errors, status_attribute_string].hash
|
|
704
730
|
end
|
|
705
731
|
|
|
706
732
|
# Builds the object from hash
|
|
@@ -63,6 +63,9 @@ module XeroRuby::Accounting
|
|
|
63
63
|
# UTC timestamp of last update to the credit note
|
|
64
64
|
attr_accessor :updated_date_utc
|
|
65
65
|
|
|
66
|
+
# UTC ISO-8601 formatted timestamp of last update to the credit note
|
|
67
|
+
attr_accessor :updated_date_utc_string
|
|
68
|
+
|
|
66
69
|
|
|
67
70
|
attr_accessor :currency_code
|
|
68
71
|
|
|
@@ -155,6 +158,7 @@ module XeroRuby::Accounting
|
|
|
155
158
|
:'cis_deduction' => :'CISDeduction',
|
|
156
159
|
:'cis_rate' => :'CISRate',
|
|
157
160
|
:'updated_date_utc' => :'UpdatedDateUTC',
|
|
161
|
+
:'updated_date_utc_string' => :'UpdatedDateUTCString',
|
|
158
162
|
:'currency_code' => :'CurrencyCode',
|
|
159
163
|
:'fully_paid_on_date' => :'FullyPaidOnDate',
|
|
160
164
|
:'credit_note_id' => :'CreditNoteID',
|
|
@@ -192,6 +196,7 @@ module XeroRuby::Accounting
|
|
|
192
196
|
:'cis_deduction' => :'BigDecimal',
|
|
193
197
|
:'cis_rate' => :'BigDecimal',
|
|
194
198
|
:'updated_date_utc' => :'DateTime',
|
|
199
|
+
:'updated_date_utc_string' => :'String',
|
|
195
200
|
:'currency_code' => :'CurrencyCode',
|
|
196
201
|
:'fully_paid_on_date' => :'Date',
|
|
197
202
|
:'credit_note_id' => :'String',
|
|
@@ -282,6 +287,10 @@ module XeroRuby::Accounting
|
|
|
282
287
|
self.updated_date_utc = attributes[:'updated_date_utc']
|
|
283
288
|
end
|
|
284
289
|
|
|
290
|
+
if attributes.key?(:'updated_date_utc_string')
|
|
291
|
+
self.updated_date_utc_string = attributes[:'updated_date_utc_string']
|
|
292
|
+
end
|
|
293
|
+
|
|
285
294
|
if attributes.key?(:'currency_code')
|
|
286
295
|
self.currency_code = attributes[:'currency_code']
|
|
287
296
|
end
|
|
@@ -424,6 +433,7 @@ module XeroRuby::Accounting
|
|
|
424
433
|
cis_deduction == o.cis_deduction &&
|
|
425
434
|
cis_rate == o.cis_rate &&
|
|
426
435
|
updated_date_utc == o.updated_date_utc &&
|
|
436
|
+
updated_date_utc_string == o.updated_date_utc_string &&
|
|
427
437
|
currency_code == o.currency_code &&
|
|
428
438
|
fully_paid_on_date == o.fully_paid_on_date &&
|
|
429
439
|
credit_note_id == o.credit_note_id &&
|
|
@@ -453,7 +463,7 @@ module XeroRuby::Accounting
|
|
|
453
463
|
# Calculates hash code according to all attributes.
|
|
454
464
|
# @return [Integer] Hash code
|
|
455
465
|
def hash
|
|
456
|
-
[type, contact, date, due_date, status, line_amount_types, line_items, sub_total, total_tax, total, cis_deduction, cis_rate, updated_date_utc, currency_code, fully_paid_on_date, credit_note_id, credit_note_number, reference, sent_to_contact, currency_rate, remaining_credit, allocations, applied_amount, payments, branding_theme_id, status_attribute_string, has_attachments, has_errors, validation_errors, warnings, invoice_addresses].hash
|
|
466
|
+
[type, contact, date, due_date, status, line_amount_types, line_items, sub_total, total_tax, total, cis_deduction, cis_rate, updated_date_utc, updated_date_utc_string, currency_code, fully_paid_on_date, credit_note_id, credit_note_number, reference, sent_to_contact, currency_rate, remaining_credit, allocations, applied_amount, payments, branding_theme_id, status_attribute_string, has_attachments, has_errors, validation_errors, warnings, invoice_addresses].hash
|
|
457
467
|
end
|
|
458
468
|
|
|
459
469
|
# Builds the object from hash
|
|
@@ -129,9 +129,12 @@ module XeroRuby::Accounting
|
|
|
129
129
|
# Sum of all credit notes, over-payments and pre-payments applied to invoice
|
|
130
130
|
attr_accessor :amount_credited
|
|
131
131
|
|
|
132
|
-
#
|
|
132
|
+
# UTC timestamp of last update to the invoice
|
|
133
133
|
attr_accessor :updated_date_utc
|
|
134
134
|
|
|
135
|
+
# UTC ISO-8601 formatted timestamp of last update to the invoice
|
|
136
|
+
attr_accessor :updated_date_utc_string
|
|
137
|
+
|
|
135
138
|
# Details of credit notes that have been applied to an invoice
|
|
136
139
|
attr_accessor :credit_notes
|
|
137
140
|
|
|
@@ -212,6 +215,7 @@ module XeroRuby::Accounting
|
|
|
212
215
|
:'fully_paid_on_date' => :'FullyPaidOnDate',
|
|
213
216
|
:'amount_credited' => :'AmountCredited',
|
|
214
217
|
:'updated_date_utc' => :'UpdatedDateUTC',
|
|
218
|
+
:'updated_date_utc_string' => :'UpdatedDateUTCString',
|
|
215
219
|
:'credit_notes' => :'CreditNotes',
|
|
216
220
|
:'attachments' => :'Attachments',
|
|
217
221
|
:'has_errors' => :'HasErrors',
|
|
@@ -259,6 +263,7 @@ module XeroRuby::Accounting
|
|
|
259
263
|
:'fully_paid_on_date' => :'Date',
|
|
260
264
|
:'amount_credited' => :'BigDecimal',
|
|
261
265
|
:'updated_date_utc' => :'DateTime',
|
|
266
|
+
:'updated_date_utc_string' => :'String',
|
|
262
267
|
:'credit_notes' => :'Array<CreditNote>',
|
|
263
268
|
:'attachments' => :'Array<Attachment>',
|
|
264
269
|
:'has_errors' => :'Boolean',
|
|
@@ -430,6 +435,10 @@ module XeroRuby::Accounting
|
|
|
430
435
|
self.updated_date_utc = attributes[:'updated_date_utc']
|
|
431
436
|
end
|
|
432
437
|
|
|
438
|
+
if attributes.key?(:'updated_date_utc_string')
|
|
439
|
+
self.updated_date_utc_string = attributes[:'updated_date_utc_string']
|
|
440
|
+
end
|
|
441
|
+
|
|
433
442
|
if attributes.key?(:'credit_notes')
|
|
434
443
|
if (value = attributes[:'credit_notes']).is_a?(Array)
|
|
435
444
|
self.credit_notes = value
|
|
@@ -562,6 +571,7 @@ module XeroRuby::Accounting
|
|
|
562
571
|
fully_paid_on_date == o.fully_paid_on_date &&
|
|
563
572
|
amount_credited == o.amount_credited &&
|
|
564
573
|
updated_date_utc == o.updated_date_utc &&
|
|
574
|
+
updated_date_utc_string == o.updated_date_utc_string &&
|
|
565
575
|
credit_notes == o.credit_notes &&
|
|
566
576
|
attachments == o.attachments &&
|
|
567
577
|
has_errors == o.has_errors &&
|
|
@@ -580,7 +590,7 @@ module XeroRuby::Accounting
|
|
|
580
590
|
# Calculates hash code according to all attributes.
|
|
581
591
|
# @return [Integer] Hash code
|
|
582
592
|
def hash
|
|
583
|
-
[type, contact, line_items, date, due_date, line_amount_types, invoice_number, reference, branding_theme_id, url, currency_code, currency_rate, status, sent_to_contact, expected_payment_date, planned_payment_date, cis_deduction, cis_rate, sub_total, total_tax, total, total_discount, invoice_id, repeating_invoice_id, has_attachments, is_discounted, payments, prepayments, overpayments, amount_due, amount_paid, fully_paid_on_date, amount_credited, updated_date_utc, credit_notes, attachments, has_errors, status_attribute_string, validation_errors, warnings, invoice_addresses].hash
|
|
593
|
+
[type, contact, line_items, date, due_date, line_amount_types, invoice_number, reference, branding_theme_id, url, currency_code, currency_rate, status, sent_to_contact, expected_payment_date, planned_payment_date, cis_deduction, cis_rate, sub_total, total_tax, total, total_discount, invoice_id, repeating_invoice_id, has_attachments, is_discounted, payments, prepayments, overpayments, amount_due, amount_paid, fully_paid_on_date, amount_credited, updated_date_utc, updated_date_utc_string, credit_notes, attachments, has_errors, status_attribute_string, validation_errors, warnings, invoice_addresses].hash
|
|
584
594
|
end
|
|
585
595
|
|
|
586
596
|
# Builds the object from hash
|