xero-ruby 7.0.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,253 @@
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
+ # Pagination information
17
+ require 'bigdecimal'
18
+
19
+ class PageInfo
20
+
21
+ attr_accessor :page
22
+
23
+
24
+ attr_accessor :page_size
25
+
26
+
27
+ attr_accessor :total_pages
28
+
29
+
30
+ attr_accessor :total_rows
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'page' => :'Page',
36
+ :'page_size' => :'PageSize',
37
+ :'total_pages' => :'TotalPages',
38
+ :'total_rows' => :'TotalRows'
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'page' => :'Integer',
46
+ :'page_size' => :'Integer',
47
+ :'total_pages' => :'Integer',
48
+ :'total_rows' => :'Integer'
49
+ }
50
+ end
51
+
52
+ # Initializes the object
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ def initialize(attributes = {})
55
+ if (!attributes.is_a?(Hash))
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::PageInfo` initialize method"
57
+ end
58
+
59
+ # check to see if the attribute exists and convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!self.class.attribute_map.key?(k.to_sym))
62
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Accounting::PageInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:'page')
68
+ self.page = attributes[:'page']
69
+ end
70
+
71
+ if attributes.key?(:'page_size')
72
+ self.page_size = attributes[:'page_size']
73
+ end
74
+
75
+ if attributes.key?(:'total_pages')
76
+ self.total_pages = attributes[:'total_pages']
77
+ end
78
+
79
+ if attributes.key?(:'total_rows')
80
+ self.total_rows = attributes[:'total_rows']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ page == o.page &&
103
+ page_size == o.page_size &&
104
+ total_pages == o.total_pages &&
105
+ total_rows == o.total_rows
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [page, page_size, total_pages, total_rows].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ new.build_from_hash(attributes)
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ self.class.openapi_types.each_pair do |key, type|
133
+ if type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
137
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
142
+ end
143
+
144
+ self
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def _deserialize(type, value)
152
+ case type.to_sym
153
+ when :DateTime
154
+ DateTime.parse(parse_date(value))
155
+ when :Date
156
+ Date.parse(parse_date(value))
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :BigDecimal
164
+ BigDecimal(value.to_s)
165
+ when :Boolean
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ XeroRuby::Accounting.const_get(type).build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash(downcase: false)
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ next if value.nil?
209
+ key = downcase ? attr : param
210
+ hash[key] = _to_hash(value, downcase: downcase)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Returns the object in the form of hash with snake_case
216
+ def to_attributes
217
+ to_hash(downcase: true)
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value, downcase: false)
225
+ if value.is_a?(Array)
226
+ value.map do |v|
227
+ v.to_hash(downcase: downcase)
228
+ end
229
+ elsif value.is_a?(Hash)
230
+ {}.tap do |hash|
231
+ value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) }
232
+ end
233
+ elsif value.respond_to? :to_hash
234
+ value.to_hash(downcase: downcase)
235
+ else
236
+ value
237
+ end
238
+ end
239
+
240
+ def parse_date(datestring)
241
+ if datestring.include?('Date')
242
+ date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\//
243
+ original, date, timezone = *date_pattern.match(datestring)
244
+ date = (date.to_i / 1000)
245
+ Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s
246
+ elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD
247
+ Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s
248
+ else # handle date 'types' for small subset of payroll API's
249
+ Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s
250
+ end
251
+ end
252
+ end
253
+ end
@@ -16,49 +16,49 @@ module XeroRuby::Finance
16
16
  require 'bigdecimal'
17
17
 
18
18
  class DataSourceResponse
19
- # Sum of the amounts of all statement lines where the source of the data was a direct bank feed in to Xero. This gives an indication on the certainty of correctness of the data.
19
+ # Sum of the amounts of all statement lines where the source of the data was a direct bank feed in to Xero via an API integration. This could be from a bank or aggregator. This gives an indication on the certainty of correctness of the data.
20
20
  attr_accessor :direct_bank_feed
21
21
 
22
- # Sum of the amounts of all statement lines where the source of the data was a indirect bank feed to Xero (usually via Yodlee). This gives an indication on the certainty of correctness of the data.
22
+ # No longer in use.
23
23
  attr_accessor :indirect_bank_feed
24
24
 
25
- # Sum of the amounts of all statement lines where the source of the data was a CSV file upload in to Xero. This gives an indication on the certainty of correctness of the data.
25
+ # Sum of the amounts of all statement lines where the source of the data was a file manually uploaded in to Xero. This gives an indication on the certainty of correctness of the data.
26
26
  attr_accessor :file_upload
27
27
 
28
- # Sum of the amounts of all statement lines where the source of the data was manually keyed in to Xero. This gives an indication on the certainty of correctness of the data.
28
+ # Sum of the amounts of all statement lines where the source of the data was manually input in to Xero. This gives an indication on the certainty of correctness of the data.
29
29
  attr_accessor :manual
30
30
 
31
- # Sum of the amounts of all statement lines where the source of the data was a direct bank feed in to Xero. This gives an indication on the certainty of correctness of the data. Only positive transactions are included.
31
+ # Sum of the amounts of all statement lines where the source of the data was a direct bank feed in to Xero via an API integration. This could be from a bank or aggregator. This gives an indication on the certainty of correctness of the data. Only positive transactions are included.
32
32
  attr_accessor :direct_bank_feed_pos
33
33
 
34
- # Sum of the amounts of all statement lines where the source of the data was a indirect bank feed to Xero (usually via Yodlee). This gives an indication on the certainty of correctness of the data. Only positive transactions are included.
34
+ # No longer in use.
35
35
  attr_accessor :indirect_bank_feed_pos
36
36
 
37
- # Sum of the amounts of all statement lines where the source of the data was a CSV file upload in to Xero. This gives an indication on the certainty of correctness of the data. Only positive transactions are included.
37
+ # Sum of the amounts of all statement lines where the source of the data was a file manually uploaded in to Xero. This gives an indication on the certainty of correctness of the data. Only positive transactions are included.
38
38
  attr_accessor :file_upload_pos
39
39
 
40
- # Sum of the amounts of all statement lines where the source of the data was manually keyed in to Xero. This gives an indication on the certainty of correctness of the data. Only positive transactions are included.
40
+ # Sum of the amounts of all statement lines where the source of the data was manually input in to Xero. This gives an indication on the certainty of correctness of the data. Only positive transactions are included.
41
41
  attr_accessor :manual_pos
42
42
 
43
- # Sum of the amounts of all statement lines where the source of the data was a direct bank feed in to Xero. This gives an indication on the certainty of correctness of the data. Only negative transactions are included.
43
+ # Sum of the amounts of all statement lines where the source of the data was a direct bank feed in to Xero via an API integration. This could be from a bank or aggregator. This gives an indication on the certainty of correctness of the data. Only negative transactions are included.
44
44
  attr_accessor :direct_bank_feed_neg
45
45
 
46
- # Sum of the amounts of all statement lines where the source of the data was a indirect bank feed to Xero (usually via Yodlee). This gives an indication on the certainty of correctness of the data. Only negative transactions are included.
46
+ # No longer in use.
47
47
  attr_accessor :indirect_bank_feed_neg
48
48
 
49
- # Sum of the amounts of all statement lines where the source of the data was a CSV file upload in to Xero. This gives an indication on the certainty of correctness of the data. Only negative transactions are included.
49
+ # Sum of the amounts of all statement lines where the source of the data was a file manually uploaded in to Xero. This gives an indication on the certainty of correctness of the data. Only negative transactions are included.
50
50
  attr_accessor :file_upload_neg
51
51
 
52
- # Sum of the amounts of all statement lines where the source of the data was manually keyed in to Xero. This gives an indication on the certainty of correctness of the data. Only negative transactions are included.
52
+ # Sum of the amounts of all statement lines where the source of the data was manually input in to Xero. This gives an indication on the certainty of correctness of the data. Only negative transactions are included.
53
53
  attr_accessor :manual_neg
54
54
 
55
- # Sum of the amounts of all statement lines where the source of the data was any other category. This gives an indication on the certainty of correctness of the data. Only positive transactions are included.
55
+ # Sum of the amounts of all statement lines where the source of the data was unknown. This gives an indication on the certainty of correctness of the data. Only positive transactions are included.
56
56
  attr_accessor :other_pos
57
57
 
58
- # Sum of the amounts of all statement lines where the source of the data was any other category. This gives an indication on the certainty of correctness of the data. Only negative transactions are included.
58
+ # Sum of the amounts of all statement lines where the source of the data was unknown. This gives an indication on the certainty of correctness of the data. Only negative transactions are included.
59
59
  attr_accessor :other_neg
60
60
 
61
- # Sum of the amounts of all statement lines where the source of the data was any other category. This gives an indication on the certainty of correctness of the data.
61
+ # Sum of the amounts of all statement lines where the source of the data was unknown. This gives an indication on the certainty of correctness of the data.
62
62
  attr_accessor :other
63
63
 
64
64
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -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: 4.0.0
10
+ The version of the XeroOpenAPI document: 5.0.0
11
11
  =end
12
12
 
13
13
  module XeroRuby
14
- VERSION = '7.0.0'
14
+ VERSION = '8.0.0'
15
15
  end
data/lib/xero-ruby.rb CHANGED
@@ -453,6 +453,15 @@ require 'xero-ruby/models/accounting/error'
453
453
  require 'xero-ruby/models/accounting/expense_claim'
454
454
  require 'xero-ruby/models/accounting/expense_claims'
455
455
  require 'xero-ruby/models/accounting/external_link'
456
+ require 'xero-ruby/models/accounting/get_bank_transactions_response'
457
+ require 'xero-ruby/models/accounting/get_contacts_response'
458
+ require 'xero-ruby/models/accounting/get_credit_notes_response'
459
+ require 'xero-ruby/models/accounting/get_invoices_response'
460
+ require 'xero-ruby/models/accounting/get_manual_journals_response'
461
+ require 'xero-ruby/models/accounting/get_overpayments_response'
462
+ require 'xero-ruby/models/accounting/get_payments_response'
463
+ require 'xero-ruby/models/accounting/get_prepayments_response'
464
+ require 'xero-ruby/models/accounting/get_purchase_orders_response'
456
465
  require 'xero-ruby/models/accounting/history_record'
457
466
  require 'xero-ruby/models/accounting/history_records'
458
467
  require 'xero-ruby/models/accounting/import_summary'
@@ -483,6 +492,7 @@ require 'xero-ruby/models/accounting/organisation'
483
492
  require 'xero-ruby/models/accounting/organisations'
484
493
  require 'xero-ruby/models/accounting/overpayment'
485
494
  require 'xero-ruby/models/accounting/overpayments'
495
+ require 'xero-ruby/models/accounting/page_info'
486
496
  require 'xero-ruby/models/accounting/payment'
487
497
  require 'xero-ruby/models/accounting/payment_delete'
488
498
  require 'xero-ruby/models/accounting/payment_service'
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: 7.0.0
4
+ version: 8.0.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: 2024-06-21 00:00:00.000000000 Z
11
+ date: 2024-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -166,6 +166,15 @@ files:
166
166
  - lib/xero-ruby/models/accounting/expense_claim.rb
167
167
  - lib/xero-ruby/models/accounting/expense_claims.rb
168
168
  - lib/xero-ruby/models/accounting/external_link.rb
169
+ - lib/xero-ruby/models/accounting/get_bank_transactions_response.rb
170
+ - lib/xero-ruby/models/accounting/get_contacts_response.rb
171
+ - lib/xero-ruby/models/accounting/get_credit_notes_response.rb
172
+ - lib/xero-ruby/models/accounting/get_invoices_response.rb
173
+ - lib/xero-ruby/models/accounting/get_manual_journals_response.rb
174
+ - lib/xero-ruby/models/accounting/get_overpayments_response.rb
175
+ - lib/xero-ruby/models/accounting/get_payments_response.rb
176
+ - lib/xero-ruby/models/accounting/get_prepayments_response.rb
177
+ - lib/xero-ruby/models/accounting/get_purchase_orders_response.rb
169
178
  - lib/xero-ruby/models/accounting/history_record.rb
170
179
  - lib/xero-ruby/models/accounting/history_records.rb
171
180
  - lib/xero-ruby/models/accounting/import_summary.rb
@@ -196,6 +205,7 @@ files:
196
205
  - lib/xero-ruby/models/accounting/organisations.rb
197
206
  - lib/xero-ruby/models/accounting/overpayment.rb
198
207
  - lib/xero-ruby/models/accounting/overpayments.rb
208
+ - lib/xero-ruby/models/accounting/page_info.rb
199
209
  - lib/xero-ruby/models/accounting/payment.rb
200
210
  - lib/xero-ruby/models/accounting/payment_delete.rb
201
211
  - lib/xero-ruby/models/accounting/payment_service.rb