xero-ruby 3.9.0 → 7.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/README.md +2 -2
- data/lib/xero-ruby/api/accounting_api.rb +1136 -46
- data/lib/xero-ruby/api/app_store_api.rb +244 -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 +87 -0
- data/lib/xero-ruby/api/payroll_uk_api.rb +81 -0
- data/lib/xero-ruby/api/project_api.rb +286 -2
- data/lib/xero-ruby/api_client.rb +9 -3
- data/lib/xero-ruby/models/accounting/account.rb +1 -1
- 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/batch_payment.rb +2 -2
- data/lib/xero-ruby/models/accounting/batch_payment_delete.rb +244 -0
- data/lib/xero-ruby/models/accounting/batch_payment_delete_by_url_param.rb +229 -0
- data/lib/xero-ruby/models/accounting/contact.rb +1 -11
- data/lib/xero-ruby/models/accounting/currency_code.rb +10 -8
- data/lib/xero-ruby/models/accounting/journal_line.rb +1 -1
- data/lib/xero-ruby/models/accounting/line_item.rb +2 -2
- data/lib/xero-ruby/models/accounting/organisation.rb +6 -2
- data/lib/xero-ruby/models/accounting/payment.rb +26 -4
- data/lib/xero-ruby/models/accounting/repeating_invoice.rb +53 -5
- data/lib/xero-ruby/models/accounting/tax_rate.rb +23 -5
- data/lib/xero-ruby/models/accounting/tax_type.rb +60 -3
- data/lib/xero-ruby/models/accounting/ten_ninety_nine_contact.rb +75 -4
- data/lib/xero-ruby/models/accounting/time_zone.rb +123 -91
- data/lib/xero-ruby/models/app_store/create_usage_record.rb +243 -0
- data/lib/xero-ruby/models/app_store/update_usage_record.rb +228 -0
- data/lib/xero-ruby/models/app_store/usage_record.rb +332 -0
- data/lib/xero-ruby/models/app_store/usage_records_list.rb +230 -0
- data/lib/xero-ruby/models/files/association.rb +31 -1
- 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 +284 -0
- data/lib/xero-ruby/models/payroll_au/earnings_rate.rb +21 -1
- data/lib/xero-ruby/models/payroll_au/earnings_type.rb +2 -0
- data/lib/xero-ruby/models/payroll_au/employee.rb +42 -2
- data/lib/xero-ruby/models/payroll_au/employment_basis.rb +1 -0
- data/lib/xero-ruby/models/payroll_au/employment_type.rb +36 -0
- data/lib/xero-ruby/models/payroll_au/income_type.rb +39 -0
- data/lib/xero-ruby/models/payroll_au/leave_application.rb +11 -1
- data/lib/xero-ruby/models/payroll_au/leave_category_code.rb +46 -0
- 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/leave_type.rb +24 -4
- 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_au/senior_marital_status.rb +37 -0
- data/lib/xero-ruby/models/payroll_au/settings.rb +14 -4
- data/lib/xero-ruby/models/payroll_au/tax_declaration.rb +51 -1
- data/lib/xero-ruby/models/payroll_au/tax_scale_type.rb +40 -0
- data/lib/xero-ruby/models/payroll_au/work_condition.rb +37 -0
- data/lib/xero-ruby/models/payroll_nz/employee.rb +14 -4
- data/lib/xero-ruby/models/payroll_uk/earnings_rate.rb +3 -3
- data/lib/xero-ruby/models/projects/currency_code.rb +0 -1
- data/lib/xero-ruby/models/projects/task.rb +6 -6
- data/lib/xero-ruby/models/projects/task_create_or_update.rb +1 -1
- data/lib/xero-ruby/version.rb +2 -2
- data/lib/xero-ruby/where.rb +2 -0
- data/lib/xero-ruby.rb +15 -0
- metadata +30 -15
@@ -0,0 +1,244 @@
|
|
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 BatchPaymentDelete
|
19
|
+
# The Xero generated unique identifier for the bank transaction (read-only)
|
20
|
+
attr_accessor :batch_payment_id
|
21
|
+
|
22
|
+
# The status of the batch payment.
|
23
|
+
attr_accessor :status
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'batch_payment_id' => :'BatchPaymentID',
|
29
|
+
:'status' => :'Status'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Attribute type mapping.
|
34
|
+
def self.openapi_types
|
35
|
+
{
|
36
|
+
:'batch_payment_id' => :'String',
|
37
|
+
:'status' => :'String'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Initializes the object
|
42
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
43
|
+
def initialize(attributes = {})
|
44
|
+
if (!attributes.is_a?(Hash))
|
45
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::BatchPaymentDelete` initialize method"
|
46
|
+
end
|
47
|
+
|
48
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
49
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
50
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
51
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Accounting::BatchPaymentDelete`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
52
|
+
end
|
53
|
+
h[k.to_sym] = v
|
54
|
+
}
|
55
|
+
|
56
|
+
if attributes.key?(:'batch_payment_id')
|
57
|
+
self.batch_payment_id = attributes[:'batch_payment_id']
|
58
|
+
end
|
59
|
+
|
60
|
+
if attributes.key?(:'status')
|
61
|
+
self.status = attributes[:'status']
|
62
|
+
else
|
63
|
+
self.status = 'DELETED'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
68
|
+
# @return Array for valid properties with the reasons
|
69
|
+
def list_invalid_properties
|
70
|
+
invalid_properties = Array.new
|
71
|
+
if @batch_payment_id.nil?
|
72
|
+
invalid_properties.push('invalid value for "batch_payment_id", batch_payment_id cannot be nil.')
|
73
|
+
end
|
74
|
+
|
75
|
+
if @status.nil?
|
76
|
+
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
77
|
+
end
|
78
|
+
|
79
|
+
invalid_properties
|
80
|
+
end
|
81
|
+
|
82
|
+
# Check to see if the all the properties in the model are valid
|
83
|
+
# @return true if the model is valid
|
84
|
+
def valid?
|
85
|
+
return false if @batch_payment_id.nil?
|
86
|
+
return false if @status.nil?
|
87
|
+
true
|
88
|
+
end
|
89
|
+
|
90
|
+
# Checks equality by comparing each attribute.
|
91
|
+
# @param [Object] Object to be compared
|
92
|
+
def ==(o)
|
93
|
+
return true if self.equal?(o)
|
94
|
+
self.class == o.class &&
|
95
|
+
batch_payment_id == o.batch_payment_id &&
|
96
|
+
status == o.status
|
97
|
+
end
|
98
|
+
|
99
|
+
# @see the `==` method
|
100
|
+
# @param [Object] Object to be compared
|
101
|
+
def eql?(o)
|
102
|
+
self == o
|
103
|
+
end
|
104
|
+
|
105
|
+
# Calculates hash code according to all attributes.
|
106
|
+
# @return [Integer] Hash code
|
107
|
+
def hash
|
108
|
+
[batch_payment_id, status].hash
|
109
|
+
end
|
110
|
+
|
111
|
+
# Builds the object from hash
|
112
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
113
|
+
# @return [Object] Returns the model itself
|
114
|
+
def self.build_from_hash(attributes)
|
115
|
+
new.build_from_hash(attributes)
|
116
|
+
end
|
117
|
+
|
118
|
+
# Builds the object from hash
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
120
|
+
# @return [Object] Returns the model itself
|
121
|
+
def build_from_hash(attributes)
|
122
|
+
return nil unless attributes.is_a?(Hash)
|
123
|
+
self.class.openapi_types.each_pair do |key, type|
|
124
|
+
if type =~ /\AArray<(.*)>/i
|
125
|
+
# check to ensure the input is an array given that the attribute
|
126
|
+
# is documented as an array but the input is not
|
127
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
128
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
129
|
+
end
|
130
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
131
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
132
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
133
|
+
end
|
134
|
+
|
135
|
+
self
|
136
|
+
end
|
137
|
+
|
138
|
+
# Deserializes the data based on type
|
139
|
+
# @param string type Data type
|
140
|
+
# @param string value Value to be deserialized
|
141
|
+
# @return [Object] Deserialized data
|
142
|
+
def _deserialize(type, value)
|
143
|
+
case type.to_sym
|
144
|
+
when :DateTime
|
145
|
+
DateTime.parse(parse_date(value))
|
146
|
+
when :Date
|
147
|
+
Date.parse(parse_date(value))
|
148
|
+
when :String
|
149
|
+
value.to_s
|
150
|
+
when :Integer
|
151
|
+
value.to_i
|
152
|
+
when :Float
|
153
|
+
value.to_f
|
154
|
+
when :BigDecimal
|
155
|
+
BigDecimal(value.to_s)
|
156
|
+
when :Boolean
|
157
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
158
|
+
true
|
159
|
+
else
|
160
|
+
false
|
161
|
+
end
|
162
|
+
when :Object
|
163
|
+
# generic object (usually a Hash), return directly
|
164
|
+
value
|
165
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
166
|
+
inner_type = Regexp.last_match[:inner_type]
|
167
|
+
value.map { |v| _deserialize(inner_type, v) }
|
168
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
169
|
+
k_type = Regexp.last_match[:k_type]
|
170
|
+
v_type = Regexp.last_match[:v_type]
|
171
|
+
{}.tap do |hash|
|
172
|
+
value.each do |k, v|
|
173
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
else # model
|
177
|
+
XeroRuby::Accounting.const_get(type).build_from_hash(value)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns the string representation of the object
|
182
|
+
# @return [String] String presentation of the object
|
183
|
+
def to_s
|
184
|
+
to_hash.to_s
|
185
|
+
end
|
186
|
+
|
187
|
+
# to_body is an alias to to_hash (backward compatibility)
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
189
|
+
def to_body
|
190
|
+
to_hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the object in the form of hash
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
195
|
+
def to_hash(downcase: false)
|
196
|
+
hash = {}
|
197
|
+
self.class.attribute_map.each_pair do |attr, param|
|
198
|
+
value = self.send(attr)
|
199
|
+
next if value.nil?
|
200
|
+
key = downcase ? attr : param
|
201
|
+
hash[key] = _to_hash(value, downcase: downcase)
|
202
|
+
end
|
203
|
+
hash
|
204
|
+
end
|
205
|
+
|
206
|
+
# Returns the object in the form of hash with snake_case
|
207
|
+
def to_attributes
|
208
|
+
to_hash(downcase: true)
|
209
|
+
end
|
210
|
+
|
211
|
+
# Outputs non-array value in the form of hash
|
212
|
+
# For object, use to_hash. Otherwise, just return the value
|
213
|
+
# @param [Object] value Any valid value
|
214
|
+
# @return [Hash] Returns the value in the form of hash
|
215
|
+
def _to_hash(value, downcase: false)
|
216
|
+
if value.is_a?(Array)
|
217
|
+
value.map do |v|
|
218
|
+
v.to_hash(downcase: downcase)
|
219
|
+
end
|
220
|
+
elsif value.is_a?(Hash)
|
221
|
+
{}.tap do |hash|
|
222
|
+
value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
|
223
|
+
end
|
224
|
+
elsif value.respond_to? :to_hash
|
225
|
+
value.to_hash(downcase: downcase)
|
226
|
+
else
|
227
|
+
value
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
def parse_date(datestring)
|
232
|
+
if datestring.include?('Date')
|
233
|
+
date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
|
234
|
+
original, date, timezone = *date_pattern.match(datestring)
|
235
|
+
date = (date.to_i / 1000)
|
236
|
+
Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
|
237
|
+
elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
|
238
|
+
Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
|
239
|
+
else # handle date 'types' for small subset of payroll API's
|
240
|
+
Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
@@ -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 BatchPaymentDeleteByUrlParam
|
19
|
+
# The status of the batch payment.
|
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::BatchPaymentDeleteByUrlParam` 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::BatchPaymentDeleteByUrlParam`. 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
|
@@ -49,9 +49,6 @@ module XeroRuby::Accounting
|
|
49
49
|
# Email address of contact person (umlauts not supported) (max length = 255)
|
50
50
|
attr_accessor :email_address
|
51
51
|
|
52
|
-
# Skype user name of contact
|
53
|
-
attr_accessor :skype_user_name
|
54
|
-
|
55
52
|
# See contact persons
|
56
53
|
attr_accessor :contact_persons
|
57
54
|
|
@@ -189,7 +186,6 @@ module XeroRuby::Accounting
|
|
189
186
|
:'last_name' => :'LastName',
|
190
187
|
:'company_number' => :'CompanyNumber',
|
191
188
|
:'email_address' => :'EmailAddress',
|
192
|
-
:'skype_user_name' => :'SkypeUserName',
|
193
189
|
:'contact_persons' => :'ContactPersons',
|
194
190
|
:'bank_account_details' => :'BankAccountDetails',
|
195
191
|
:'tax_number' => :'TaxNumber',
|
@@ -238,7 +234,6 @@ module XeroRuby::Accounting
|
|
238
234
|
:'last_name' => :'String',
|
239
235
|
:'company_number' => :'String',
|
240
236
|
:'email_address' => :'String',
|
241
|
-
:'skype_user_name' => :'String',
|
242
237
|
:'contact_persons' => :'Array<ContactPerson>',
|
243
238
|
:'bank_account_details' => :'String',
|
244
239
|
:'tax_number' => :'String',
|
@@ -329,10 +324,6 @@ module XeroRuby::Accounting
|
|
329
324
|
self.email_address = attributes[:'email_address']
|
330
325
|
end
|
331
326
|
|
332
|
-
if attributes.key?(:'skype_user_name')
|
333
|
-
self.skype_user_name = attributes[:'skype_user_name']
|
334
|
-
end
|
335
|
-
|
336
327
|
if attributes.key?(:'contact_persons')
|
337
328
|
if (value = attributes[:'contact_persons']).is_a?(Array)
|
338
329
|
self.contact_persons = value
|
@@ -666,7 +657,6 @@ module XeroRuby::Accounting
|
|
666
657
|
last_name == o.last_name &&
|
667
658
|
company_number == o.company_number &&
|
668
659
|
email_address == o.email_address &&
|
669
|
-
skype_user_name == o.skype_user_name &&
|
670
660
|
contact_persons == o.contact_persons &&
|
671
661
|
bank_account_details == o.bank_account_details &&
|
672
662
|
tax_number == o.tax_number &&
|
@@ -710,7 +700,7 @@ module XeroRuby::Accounting
|
|
710
700
|
# Calculates hash code according to all attributes.
|
711
701
|
# @return [Integer] Hash code
|
712
702
|
def hash
|
713
|
-
[contact_id, merged_to_contact_id, contact_number, account_number, contact_status, name, first_name, last_name, company_number, email_address,
|
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
|
714
704
|
end
|
715
705
|
|
716
706
|
# Builds the object from hash
|
@@ -43,6 +43,7 @@ module XeroRuby::Accounting
|
|
43
43
|
CAD ||= "CAD".freeze
|
44
44
|
CDF ||= "CDF".freeze
|
45
45
|
CHF ||= "CHF".freeze
|
46
|
+
CLF ||= "CLF".freeze
|
46
47
|
CLP ||= "CLP".freeze
|
47
48
|
CNY ||= "CNY".freeze
|
48
49
|
COP ||= "COP".freeze
|
@@ -55,6 +56,7 @@ module XeroRuby::Accounting
|
|
55
56
|
DKK ||= "DKK".freeze
|
56
57
|
DOP ||= "DOP".freeze
|
57
58
|
DZD ||= "DZD".freeze
|
59
|
+
EEK ||= "EEK".freeze
|
58
60
|
EGP ||= "EGP".freeze
|
59
61
|
ERN ||= "ERN".freeze
|
60
62
|
ETB ||= "ETB".freeze
|
@@ -63,7 +65,6 @@ module XeroRuby::Accounting
|
|
63
65
|
FKP ||= "FKP".freeze
|
64
66
|
GBP ||= "GBP".freeze
|
65
67
|
GEL ||= "GEL".freeze
|
66
|
-
GGP ||= "GGP".freeze
|
67
68
|
GHS ||= "GHS".freeze
|
68
69
|
GIP ||= "GIP".freeze
|
69
70
|
GMD ||= "GMD".freeze
|
@@ -77,12 +78,10 @@ module XeroRuby::Accounting
|
|
77
78
|
HUF ||= "HUF".freeze
|
78
79
|
IDR ||= "IDR".freeze
|
79
80
|
ILS ||= "ILS".freeze
|
80
|
-
IMP ||= "IMP".freeze
|
81
81
|
INR ||= "INR".freeze
|
82
82
|
IQD ||= "IQD".freeze
|
83
83
|
IRR ||= "IRR".freeze
|
84
84
|
ISK ||= "ISK".freeze
|
85
|
-
JEP ||= "JEP".freeze
|
86
85
|
JMD ||= "JMD".freeze
|
87
86
|
JOD ||= "JOD".freeze
|
88
87
|
JPY ||= "JPY".freeze
|
@@ -101,6 +100,7 @@ module XeroRuby::Accounting
|
|
101
100
|
LRD ||= "LRD".freeze
|
102
101
|
LSL ||= "LSL".freeze
|
103
102
|
LTL ||= "LTL".freeze
|
103
|
+
LVL ||= "LVL".freeze
|
104
104
|
LYD ||= "LYD".freeze
|
105
105
|
MAD ||= "MAD".freeze
|
106
106
|
MDL ||= "MDL".freeze
|
@@ -109,11 +109,13 @@ module XeroRuby::Accounting
|
|
109
109
|
MMK ||= "MMK".freeze
|
110
110
|
MNT ||= "MNT".freeze
|
111
111
|
MOP ||= "MOP".freeze
|
112
|
+
MRO ||= "MRO".freeze
|
112
113
|
MRU ||= "MRU".freeze
|
113
114
|
MUR ||= "MUR".freeze
|
114
115
|
MVR ||= "MVR".freeze
|
115
116
|
MWK ||= "MWK".freeze
|
116
117
|
MXN ||= "MXN".freeze
|
118
|
+
MXV ||= "MXV".freeze
|
117
119
|
MYR ||= "MYR".freeze
|
118
120
|
MZN ||= "MZN".freeze
|
119
121
|
NAD ||= "NAD".freeze
|
@@ -142,11 +144,13 @@ module XeroRuby::Accounting
|
|
142
144
|
SEK ||= "SEK".freeze
|
143
145
|
SGD ||= "SGD".freeze
|
144
146
|
SHP ||= "SHP".freeze
|
147
|
+
SKK ||= "SKK".freeze
|
148
|
+
SLE ||= "SLE".freeze
|
145
149
|
SLL ||= "SLL".freeze
|
146
150
|
SOS ||= "SOS".freeze
|
147
|
-
SPL ||= "SPL".freeze
|
148
151
|
SRD ||= "SRD".freeze
|
149
|
-
STN ||= "
|
152
|
+
STN ||= "STD".freeze
|
153
|
+
STD ||= "STN".freeze
|
150
154
|
SVC ||= "SVC".freeze
|
151
155
|
SYP ||= "SYP".freeze
|
152
156
|
SZL ||= "SZL".freeze
|
@@ -157,7 +161,6 @@ module XeroRuby::Accounting
|
|
157
161
|
TOP ||= "TOP".freeze
|
158
162
|
TRY_LIRA ||= "TRY".freeze
|
159
163
|
TTD ||= "TTD".freeze
|
160
|
-
TVD ||= "TVD".freeze
|
161
164
|
TWD ||= "TWD".freeze
|
162
165
|
TZS ||= "TZS".freeze
|
163
166
|
UAH ||= "UAH".freeze
|
@@ -166,12 +169,12 @@ module XeroRuby::Accounting
|
|
166
169
|
UYU ||= "UYU".freeze
|
167
170
|
UZS ||= "UZS".freeze
|
168
171
|
VEF ||= "VEF".freeze
|
172
|
+
VES ||= "VES".freeze
|
169
173
|
VND ||= "VND".freeze
|
170
174
|
VUV ||= "VUV".freeze
|
171
175
|
WST ||= "WST".freeze
|
172
176
|
XAF ||= "XAF".freeze
|
173
177
|
XCD ||= "XCD".freeze
|
174
|
-
XDR ||= "XDR".freeze
|
175
178
|
XOF ||= "XOF".freeze
|
176
179
|
XPF ||= "XPF".freeze
|
177
180
|
YER ||= "YER".freeze
|
@@ -179,7 +182,6 @@ module XeroRuby::Accounting
|
|
179
182
|
ZMW ||= "ZMW".freeze
|
180
183
|
ZMK ||= "ZMK".freeze
|
181
184
|
ZWD ||= "ZWD".freeze
|
182
|
-
EMPTY_CURRENCY ||= "".freeze
|
183
185
|
|
184
186
|
# Builds the enum from string
|
185
187
|
# @param [String] The enum value in the form of the string
|
@@ -46,7 +46,7 @@ module XeroRuby::Accounting
|
|
46
46
|
|
47
47
|
attr_accessor :item
|
48
48
|
|
49
|
-
# If you wish to omit either
|
49
|
+
# If you wish to omit either 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 either a DiscountRate or DiscountAmount has been used i.e. LineAmount = Quantity * Unit Amount * ((100 - DiscountRate)/100) or LineAmount = (Quantity * UnitAmount) - DiscountAmount
|
50
50
|
attr_accessor :line_amount
|
51
51
|
|
52
52
|
# Optional Tracking Category – see Tracking. Any LineItem can have a maximum of 2 <TrackingCategory> elements.
|
@@ -55,7 +55,7 @@ module XeroRuby::Accounting
|
|
55
55
|
# Percentage discount being applied to a line item (only supported on ACCREC invoices – ACC PAY invoices and credit notes in Xero do not support discounts
|
56
56
|
attr_accessor :discount_rate
|
57
57
|
|
58
|
-
# Discount amount being applied to a line item. Only supported on ACCREC invoices
|
58
|
+
# Discount amount being applied to a line item. Only supported on ACCREC invoices and quotes. ACCPAY invoices and credit notes in Xero do not support discounts.
|
59
59
|
attr_accessor :discount_amount
|
60
60
|
|
61
61
|
# The Xero identifier for a Repeating Invoice
|
@@ -167,6 +167,10 @@ module XeroRuby::Accounting
|
|
167
167
|
GST_CASHBOOK ||= "GST_CASHBOOK".freeze
|
168
168
|
NON_GST_CASHBOOK ||= "NON_GST_CASHBOOK".freeze
|
169
169
|
ULTIMATE ||= "ULTIMATE".freeze
|
170
|
+
LITE ||= "LITE".freeze
|
171
|
+
IGNITE ||= "IGNITE".freeze
|
172
|
+
GROW ||= "GROW".freeze
|
173
|
+
COMPREHENSIVE ||= "COMPREHENSIVE".freeze
|
170
174
|
|
171
175
|
# BUSINESS or PARTNER. Partner edition organisations are sold exclusively through accounting partners and have restricted functionality (e.g. no access to invoicing)
|
172
176
|
attr_accessor :edition
|
@@ -462,7 +466,7 @@ module XeroRuby::Accounting
|
|
462
466
|
return false unless sales_tax_period_validator.valid?(@sales_tax_period)
|
463
467
|
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"])
|
464
468
|
return false unless organisation_entity_type_validator.valid?(@organisation_entity_type)
|
465
|
-
_class_validator = EnumAttributeValidator.new('String', ["DEMO", "TRIAL", "STARTER", "STANDARD", "PREMIUM", "PREMIUM_20", "PREMIUM_50", "PREMIUM_100", "LEDGER", "GST_CASHBOOK", "NON_GST_CASHBOOK", "ULTIMATE"])
|
469
|
+
_class_validator = EnumAttributeValidator.new('String', ["DEMO", "TRIAL", "STARTER", "STANDARD", "PREMIUM", "PREMIUM_20", "PREMIUM_50", "PREMIUM_100", "LEDGER", "GST_CASHBOOK", "NON_GST_CASHBOOK", "ULTIMATE", "LITE", "IGNITE", "GROW", "COMPREHENSIVE"])
|
466
470
|
return false unless _class_validator.valid?(@_class)
|
467
471
|
edition_validator = EnumAttributeValidator.new('String', ["BUSINESS", "PARTNER"])
|
468
472
|
return false unless edition_validator.valid?(@edition)
|
@@ -522,7 +526,7 @@ module XeroRuby::Accounting
|
|
522
526
|
# Custom attribute writer method checking allowed values (enum).
|
523
527
|
# @param [Object] _class Object to be assigned
|
524
528
|
def _class=(_class)
|
525
|
-
validator = EnumAttributeValidator.new('String', ["DEMO", "TRIAL", "STARTER", "STANDARD", "PREMIUM", "PREMIUM_20", "PREMIUM_50", "PREMIUM_100", "LEDGER", "GST_CASHBOOK", "NON_GST_CASHBOOK", "ULTIMATE"])
|
529
|
+
validator = EnumAttributeValidator.new('String', ["DEMO", "TRIAL", "STARTER", "STANDARD", "PREMIUM", "PREMIUM_20", "PREMIUM_50", "PREMIUM_100", "LEDGER", "GST_CASHBOOK", "NON_GST_CASHBOOK", "ULTIMATE", "LITE", "IGNITE", "GROW", "COMPREHENSIVE"])
|
526
530
|
unless validator.valid?(_class)
|
527
531
|
fail ArgumentError, "invalid value for \"_class\", must be one of #{validator.allowable_values}."
|
528
532
|
end
|