xero-ruby 3.6.0 → 3.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,274 @@
1
+ =begin
2
+ #Xero Finance API
3
+
4
+ #The Finance API is a collection of endpoints which customers can use in the course of a loan application, which may assist lenders to gain the confidence they need to provide capital.
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::Finance
16
+ require 'bigdecimal'
17
+
18
+ class StatementResponse
19
+ # Xero Identifier of statement
20
+ attr_accessor :statement_id
21
+
22
+ # Start date of statement
23
+ attr_accessor :start_date
24
+
25
+ # End date of statement
26
+ attr_accessor :end_date
27
+
28
+ # Utc date time of when the statement was imported in Xero
29
+ attr_accessor :imported_date_time_utc
30
+
31
+ # Import source of statement (STMTIMPORTSRC/MANUAL, STMTIMPORTSRC/CSV, STMTIMPORTSRC/QIF, STMTIMPORTSRC/OFX, XeroApi)
32
+ attr_accessor :import_source
33
+
34
+ # List of statement lines
35
+ attr_accessor :statement_lines
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+ :'statement_id' => :'statementId',
41
+ :'start_date' => :'startDate',
42
+ :'end_date' => :'endDate',
43
+ :'imported_date_time_utc' => :'importedDateTimeUtc',
44
+ :'import_source' => :'importSource',
45
+ :'statement_lines' => :'statementLines'
46
+ }
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'statement_id' => :'String',
53
+ :'start_date' => :'Date',
54
+ :'end_date' => :'Date',
55
+ :'imported_date_time_utc' => :'DateTime',
56
+ :'import_source' => :'String',
57
+ :'statement_lines' => :'Array<StatementLineResponse>'
58
+ }
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Finance::StatementResponse` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Finance::StatementResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'statement_id')
77
+ self.statement_id = attributes[:'statement_id']
78
+ end
79
+
80
+ if attributes.key?(:'start_date')
81
+ self.start_date = attributes[:'start_date']
82
+ end
83
+
84
+ if attributes.key?(:'end_date')
85
+ self.end_date = attributes[:'end_date']
86
+ end
87
+
88
+ if attributes.key?(:'imported_date_time_utc')
89
+ self.imported_date_time_utc = attributes[:'imported_date_time_utc']
90
+ end
91
+
92
+ if attributes.key?(:'import_source')
93
+ self.import_source = attributes[:'import_source']
94
+ end
95
+
96
+ if attributes.key?(:'statement_lines')
97
+ if (value = attributes[:'statement_lines']).is_a?(Array)
98
+ self.statement_lines = value
99
+ end
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ invalid_properties = Array.new
107
+ invalid_properties
108
+ end
109
+
110
+ # Check to see if the all the properties in the model are valid
111
+ # @return true if the model is valid
112
+ def valid?
113
+ true
114
+ end
115
+
116
+ # Checks equality by comparing each attribute.
117
+ # @param [Object] Object to be compared
118
+ def ==(o)
119
+ return true if self.equal?(o)
120
+ self.class == o.class &&
121
+ statement_id == o.statement_id &&
122
+ start_date == o.start_date &&
123
+ end_date == o.end_date &&
124
+ imported_date_time_utc == o.imported_date_time_utc &&
125
+ import_source == o.import_source &&
126
+ statement_lines == o.statement_lines
127
+ end
128
+
129
+ # @see the `==` method
130
+ # @param [Object] Object to be compared
131
+ def eql?(o)
132
+ self == o
133
+ end
134
+
135
+ # Calculates hash code according to all attributes.
136
+ # @return [Integer] Hash code
137
+ def hash
138
+ [statement_id, start_date, end_date, imported_date_time_utc, import_source, statement_lines].hash
139
+ end
140
+
141
+ # Builds the object from hash
142
+ # @param [Hash] attributes Model attributes in the form of hash
143
+ # @return [Object] Returns the model itself
144
+ def self.build_from_hash(attributes)
145
+ new.build_from_hash(attributes)
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def build_from_hash(attributes)
152
+ return nil unless attributes.is_a?(Hash)
153
+ self.class.openapi_types.each_pair do |key, type|
154
+ if type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
158
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
159
+ end
160
+ elsif !attributes[self.class.attribute_map[key]].nil?
161
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
162
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
163
+ end
164
+
165
+ self
166
+ end
167
+
168
+ # Deserializes the data based on type
169
+ # @param string type Data type
170
+ # @param string value Value to be deserialized
171
+ # @return [Object] Deserialized data
172
+ def _deserialize(type, value)
173
+ case type.to_sym
174
+ when :DateTime
175
+ DateTime.parse(parse_date(value))
176
+ when :Date
177
+ Date.parse(parse_date(value))
178
+ when :String
179
+ value.to_s
180
+ when :Integer
181
+ value.to_i
182
+ when :Float
183
+ value.to_f
184
+ when :BigDecimal
185
+ BigDecimal(value.to_s)
186
+ when :Boolean
187
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
188
+ true
189
+ else
190
+ false
191
+ end
192
+ when :Object
193
+ # generic object (usually a Hash), return directly
194
+ value
195
+ when /\AArray<(?<inner_type>.+)>\z/
196
+ inner_type = Regexp.last_match[:inner_type]
197
+ value.map { |v| _deserialize(inner_type, v) }
198
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
199
+ k_type = Regexp.last_match[:k_type]
200
+ v_type = Regexp.last_match[:v_type]
201
+ {}.tap do |hash|
202
+ value.each do |k, v|
203
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
204
+ end
205
+ end
206
+ else # model
207
+ XeroRuby::Finance.const_get(type).build_from_hash(value)
208
+ end
209
+ end
210
+
211
+ # Returns the string representation of the object
212
+ # @return [String] String presentation of the object
213
+ def to_s
214
+ to_hash.to_s
215
+ end
216
+
217
+ # to_body is an alias to to_hash (backward compatibility)
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_body
220
+ to_hash
221
+ end
222
+
223
+ # Returns the object in the form of hash
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_hash(downcase: false)
226
+ hash = {}
227
+ self.class.attribute_map.each_pair do |attr, param|
228
+ value = self.send(attr)
229
+ next if value.nil?
230
+ key = downcase ? attr : param
231
+ hash[key] = _to_hash(value, downcase: downcase)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Returns the object in the form of hash with snake_case
237
+ def to_attributes
238
+ to_hash(downcase: true)
239
+ end
240
+
241
+ # Outputs non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ # @param [Object] value Any valid value
244
+ # @return [Hash] Returns the value in the form of hash
245
+ def _to_hash(value, downcase: false)
246
+ if value.is_a?(Array)
247
+ value.map do |v|
248
+ v.to_hash(downcase: downcase)
249
+ end
250
+ elsif value.is_a?(Hash)
251
+ {}.tap do |hash|
252
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
253
+ end
254
+ elsif value.respond_to? :to_hash
255
+ value.to_hash(downcase: downcase)
256
+ else
257
+ value
258
+ end
259
+ end
260
+
261
+ def parse_date(datestring)
262
+ if datestring.include?('Date')
263
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
264
+ original, date, timezone = *date_pattern.match(datestring)
265
+ date = (date.to_i / 1000)
266
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
267
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
268
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
269
+ else # handle date 'types' for small subset of payroll API's
270
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
271
+ end
272
+ end
273
+ end
274
+ end
@@ -63,6 +63,9 @@ module XeroRuby::PayrollUk
63
63
  # National insurance number of the employee
64
64
  attr_accessor :national_insurance_number
65
65
 
66
+ # Whether the employee is an off payroll worker
67
+ attr_accessor :is_off_payroll_worker
68
+
66
69
  class EnumAttributeValidator
67
70
  attr_reader :datatype
68
71
  attr_reader :allowable_values
@@ -102,7 +105,8 @@ module XeroRuby::PayrollUk
102
105
  :'payroll_calendar_id' => :'payrollCalendarID',
103
106
  :'updated_date_utc' => :'updatedDateUTC',
104
107
  :'created_date_utc' => :'createdDateUTC',
105
- :'national_insurance_number' => :'nationalInsuranceNumber'
108
+ :'national_insurance_number' => :'nationalInsuranceNumber',
109
+ :'is_off_payroll_worker' => :'isOffPayrollWorker'
106
110
  }
107
111
  end
108
112
 
@@ -123,7 +127,8 @@ module XeroRuby::PayrollUk
123
127
  :'payroll_calendar_id' => :'String',
124
128
  :'updated_date_utc' => :'DateTime',
125
129
  :'created_date_utc' => :'DateTime',
126
- :'national_insurance_number' => :'String'
130
+ :'national_insurance_number' => :'String',
131
+ :'is_off_payroll_worker' => :'Boolean'
127
132
  }
128
133
  end
129
134
 
@@ -201,6 +206,10 @@ module XeroRuby::PayrollUk
201
206
  if attributes.key?(:'national_insurance_number')
202
207
  self.national_insurance_number = attributes[:'national_insurance_number']
203
208
  end
209
+
210
+ if attributes.key?(:'is_off_payroll_worker')
211
+ self.is_off_payroll_worker = attributes[:'is_off_payroll_worker']
212
+ end
204
213
  end
205
214
 
206
215
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -247,7 +256,8 @@ module XeroRuby::PayrollUk
247
256
  payroll_calendar_id == o.payroll_calendar_id &&
248
257
  updated_date_utc == o.updated_date_utc &&
249
258
  created_date_utc == o.created_date_utc &&
250
- national_insurance_number == o.national_insurance_number
259
+ national_insurance_number == o.national_insurance_number &&
260
+ is_off_payroll_worker == o.is_off_payroll_worker
251
261
  end
252
262
 
253
263
  # @see the `==` method
@@ -259,7 +269,7 @@ module XeroRuby::PayrollUk
259
269
  # Calculates hash code according to all attributes.
260
270
  # @return [Integer] Hash code
261
271
  def hash
262
- [employee_id, title, first_name, last_name, date_of_birth, address, email, gender, phone_number, start_date, end_date, payroll_calendar_id, updated_date_utc, created_date_utc, national_insurance_number].hash
272
+ [employee_id, title, first_name, last_name, date_of_birth, address, email, gender, phone_number, start_date, end_date, payroll_calendar_id, updated_date_utc, created_date_utc, national_insurance_number, is_off_payroll_worker].hash
263
273
  end
264
274
 
265
275
  # Builds the object from hash
@@ -30,11 +30,16 @@ module XeroRuby::PayrollUk
30
30
  A ||= "A".freeze
31
31
  B ||= "B".freeze
32
32
  C ||= "C".freeze
33
+ F ||= "F".freeze
33
34
  H ||= "H".freeze
35
+ I ||= "I".freeze
34
36
  J ||= "J".freeze
37
+ L ||= "L".freeze
35
38
  M ||= "M".freeze
36
- Z ||= "Z".freeze
39
+ S ||= "S".freeze
40
+ V ||= "V".freeze
37
41
  X ||= "X".freeze
42
+ Z ||= "Z".freeze
38
43
 
39
44
  class EnumAttributeValidator
40
45
  attr_reader :datatype
@@ -120,7 +125,7 @@ module XeroRuby::PayrollUk
120
125
  # Check to see if the all the properties in the model are valid
121
126
  # @return true if the model is valid
122
127
  def valid?
123
- ni_category_validator = EnumAttributeValidator.new('String', ["A", "B", "C", "H", "J", "M", "Z", "X"])
128
+ ni_category_validator = EnumAttributeValidator.new('String', ["A", "B", "C", "F", "H", "I", "J", "L", "M", "S", "V", "X", "Z"])
124
129
  return false unless ni_category_validator.valid?(@ni_category)
125
130
  true
126
131
  end
@@ -128,7 +133,7 @@ module XeroRuby::PayrollUk
128
133
  # Custom attribute writer method checking allowed values (enum).
129
134
  # @param [Object] ni_category Object to be assigned
130
135
  def ni_category=(ni_category)
131
- validator = EnumAttributeValidator.new('String', ["A", "B", "C", "H", "J", "M", "Z", "X"])
136
+ validator = EnumAttributeValidator.new('String', ["A", "B", "C", "F", "H", "I", "J", "L", "M", "S", "V", "X", "Z"])
132
137
  unless validator.valid?(ni_category)
133
138
  fail ArgumentError, "invalid value for \"ni_category\", must be one of #{validator.allowable_values}."
134
139
  end
@@ -7,9 +7,9 @@ Contact: api@xero.com
7
7
  Generated by: https://openapi-generator.tech
8
8
  OpenAPI Generator version: 4.3.1
9
9
 
10
- The version of the XeroOpenAPI document: 2.17.4
10
+ The version of the XeroOpenAPI document: 2.21.0
11
11
  =end
12
12
 
13
13
  module XeroRuby
14
- VERSION = '3.6.0'
14
+ VERSION = '3.8.0'
15
15
  end
data/lib/xero-ruby.rb CHANGED
@@ -24,7 +24,9 @@ require 'xero-ruby/models/finance/balance_sheet_account_detail'
24
24
  require 'xero-ruby/models/finance/balance_sheet_account_group'
25
25
  require 'xero-ruby/models/finance/balance_sheet_account_type'
26
26
  require 'xero-ruby/models/finance/balance_sheet_response'
27
+ require 'xero-ruby/models/finance/bank_statement_accounting_response'
27
28
  require 'xero-ruby/models/finance/bank_statement_response'
29
+ require 'xero-ruby/models/finance/bank_transaction_response'
28
30
  require 'xero-ruby/models/finance/cash_account_response'
29
31
  require 'xero-ruby/models/finance/cash_balance'
30
32
  require 'xero-ruby/models/finance/cash_validation_response'
@@ -33,26 +35,35 @@ require 'xero-ruby/models/finance/cashflow_activity'
33
35
  require 'xero-ruby/models/finance/cashflow_response'
34
36
  require 'xero-ruby/models/finance/cashflow_type'
35
37
  require 'xero-ruby/models/finance/contact_detail'
38
+ require 'xero-ruby/models/finance/contact_response'
36
39
  require 'xero-ruby/models/finance/contact_total_detail'
37
40
  require 'xero-ruby/models/finance/contact_total_other'
41
+ require 'xero-ruby/models/finance/credit_note_response'
38
42
  require 'xero-ruby/models/finance/current_statement_response'
39
43
  require 'xero-ruby/models/finance/data_source_response'
40
44
  require 'xero-ruby/models/finance/history_record_response'
41
45
  require 'xero-ruby/models/finance/income_by_contact_response'
46
+ require 'xero-ruby/models/finance/invoice_response'
47
+ require 'xero-ruby/models/finance/line_item_response'
42
48
  require 'xero-ruby/models/finance/lock_history_model'
43
49
  require 'xero-ruby/models/finance/lock_history_response'
44
50
  require 'xero-ruby/models/finance/manual_journal_total'
51
+ require 'xero-ruby/models/finance/overpayment_response'
52
+ require 'xero-ruby/models/finance/payment_response'
45
53
  require 'xero-ruby/models/finance/pnl_account'
46
54
  require 'xero-ruby/models/finance/pnl_account_class'
47
55
  require 'xero-ruby/models/finance/pnl_account_type'
48
56
  require 'xero-ruby/models/finance/practice_response'
57
+ require 'xero-ruby/models/finance/prepayment_response'
49
58
  require 'xero-ruby/models/finance/problem'
50
59
  require 'xero-ruby/models/finance/problem_type'
51
60
  require 'xero-ruby/models/finance/profit_and_loss_response'
52
61
  require 'xero-ruby/models/finance/report_history_model'
53
62
  require 'xero-ruby/models/finance/report_history_response'
54
63
  require 'xero-ruby/models/finance/statement_balance_response'
64
+ require 'xero-ruby/models/finance/statement_line_response'
55
65
  require 'xero-ruby/models/finance/statement_lines_response'
66
+ require 'xero-ruby/models/finance/statement_response'
56
67
  require 'xero-ruby/models/finance/total_detail'
57
68
  require 'xero-ruby/models/finance/total_other'
58
69
  require 'xero-ruby/models/finance/trial_balance_account'
@@ -444,6 +455,7 @@ require 'xero-ruby/models/accounting/journal_line'
444
455
  require 'xero-ruby/models/accounting/journals'
445
456
  require 'xero-ruby/models/accounting/line_amount_types'
446
457
  require 'xero-ruby/models/accounting/line_item'
458
+ require 'xero-ruby/models/accounting/line_item_item'
447
459
  require 'xero-ruby/models/accounting/line_item_tracking'
448
460
  require 'xero-ruby/models/accounting/linked_transaction'
449
461
  require 'xero-ruby/models/accounting/linked_transactions'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xero-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.0
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xero API Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-01 00:00:00.000000000 Z
11
+ date: 2022-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -181,6 +181,7 @@ files:
181
181
  - lib/xero-ruby/models/accounting/journals.rb
182
182
  - lib/xero-ruby/models/accounting/line_amount_types.rb
183
183
  - lib/xero-ruby/models/accounting/line_item.rb
184
+ - lib/xero-ruby/models/accounting/line_item_item.rb
184
185
  - lib/xero-ruby/models/accounting/line_item_tracking.rb
185
186
  - lib/xero-ruby/models/accounting/linked_transaction.rb
186
187
  - lib/xero-ruby/models/accounting/linked_transactions.rb
@@ -274,7 +275,9 @@ files:
274
275
  - lib/xero-ruby/models/finance/balance_sheet_account_group.rb
275
276
  - lib/xero-ruby/models/finance/balance_sheet_account_type.rb
276
277
  - lib/xero-ruby/models/finance/balance_sheet_response.rb
278
+ - lib/xero-ruby/models/finance/bank_statement_accounting_response.rb
277
279
  - lib/xero-ruby/models/finance/bank_statement_response.rb
280
+ - lib/xero-ruby/models/finance/bank_transaction_response.rb
278
281
  - lib/xero-ruby/models/finance/cash_account_response.rb
279
282
  - lib/xero-ruby/models/finance/cash_balance.rb
280
283
  - lib/xero-ruby/models/finance/cash_validation_response.rb
@@ -283,26 +286,35 @@ files:
283
286
  - lib/xero-ruby/models/finance/cashflow_response.rb
284
287
  - lib/xero-ruby/models/finance/cashflow_type.rb
285
288
  - lib/xero-ruby/models/finance/contact_detail.rb
289
+ - lib/xero-ruby/models/finance/contact_response.rb
286
290
  - lib/xero-ruby/models/finance/contact_total_detail.rb
287
291
  - lib/xero-ruby/models/finance/contact_total_other.rb
292
+ - lib/xero-ruby/models/finance/credit_note_response.rb
288
293
  - lib/xero-ruby/models/finance/current_statement_response.rb
289
294
  - lib/xero-ruby/models/finance/data_source_response.rb
290
295
  - lib/xero-ruby/models/finance/history_record_response.rb
291
296
  - lib/xero-ruby/models/finance/income_by_contact_response.rb
297
+ - lib/xero-ruby/models/finance/invoice_response.rb
298
+ - lib/xero-ruby/models/finance/line_item_response.rb
292
299
  - lib/xero-ruby/models/finance/lock_history_model.rb
293
300
  - lib/xero-ruby/models/finance/lock_history_response.rb
294
301
  - lib/xero-ruby/models/finance/manual_journal_total.rb
302
+ - lib/xero-ruby/models/finance/overpayment_response.rb
303
+ - lib/xero-ruby/models/finance/payment_response.rb
295
304
  - lib/xero-ruby/models/finance/pnl_account.rb
296
305
  - lib/xero-ruby/models/finance/pnl_account_class.rb
297
306
  - lib/xero-ruby/models/finance/pnl_account_type.rb
298
307
  - lib/xero-ruby/models/finance/practice_response.rb
308
+ - lib/xero-ruby/models/finance/prepayment_response.rb
299
309
  - lib/xero-ruby/models/finance/problem.rb
300
310
  - lib/xero-ruby/models/finance/problem_type.rb
301
311
  - lib/xero-ruby/models/finance/profit_and_loss_response.rb
302
312
  - lib/xero-ruby/models/finance/report_history_model.rb
303
313
  - lib/xero-ruby/models/finance/report_history_response.rb
304
314
  - lib/xero-ruby/models/finance/statement_balance_response.rb
315
+ - lib/xero-ruby/models/finance/statement_line_response.rb
305
316
  - lib/xero-ruby/models/finance/statement_lines_response.rb
317
+ - lib/xero-ruby/models/finance/statement_response.rb
306
318
  - lib/xero-ruby/models/finance/total_detail.rb
307
319
  - lib/xero-ruby/models/finance/total_other.rb
308
320
  - lib/xero-ruby/models/finance/trial_balance_account.rb