xero-ruby 8.0.0 → 9.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.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/lib/xero-ruby/api/accounting_api.rb +36 -27
  3. data/lib/xero-ruby/models/accounting/bank_transactions.rb +11 -1
  4. data/lib/xero-ruby/models/accounting/contacts.rb +11 -1
  5. data/lib/xero-ruby/models/accounting/credit_notes.rb +11 -1
  6. data/lib/xero-ruby/models/accounting/invoices.rb +11 -1
  7. data/lib/xero-ruby/models/accounting/manual_journals.rb +11 -1
  8. data/lib/xero-ruby/models/accounting/organisation.rb +6 -2
  9. data/lib/xero-ruby/models/accounting/overpayments.rb +11 -1
  10. data/lib/xero-ruby/models/accounting/{page_info.rb → pagination.rb} +18 -19
  11. data/lib/xero-ruby/models/accounting/payments.rb +11 -1
  12. data/lib/xero-ruby/models/accounting/prepayments.rb +11 -1
  13. data/lib/xero-ruby/models/accounting/purchase_orders.rb +11 -1
  14. data/lib/xero-ruby/version.rb +2 -2
  15. data/lib/xero-ruby.rb +1 -10
  16. metadata +3 -12
  17. data/lib/xero-ruby/models/accounting/get_bank_transactions_response.rb +0 -274
  18. data/lib/xero-ruby/models/accounting/get_contacts_response.rb +0 -274
  19. data/lib/xero-ruby/models/accounting/get_credit_notes_response.rb +0 -274
  20. data/lib/xero-ruby/models/accounting/get_invoices_response.rb +0 -274
  21. data/lib/xero-ruby/models/accounting/get_manual_journals_response.rb +0 -274
  22. data/lib/xero-ruby/models/accounting/get_overpayments_response.rb +0 -274
  23. data/lib/xero-ruby/models/accounting/get_payments_response.rb +0 -274
  24. data/lib/xero-ruby/models/accounting/get_prepayments_response.rb +0 -274
  25. data/lib/xero-ruby/models/accounting/get_purchase_orders_response.rb +0 -274
@@ -13,10 +13,9 @@ require 'time'
13
13
  require 'date'
14
14
 
15
15
  module XeroRuby::Accounting
16
- # Pagination information
17
16
  require 'bigdecimal'
18
17
 
19
- class PageInfo
18
+ class Pagination
20
19
 
21
20
  attr_accessor :page
22
21
 
@@ -24,18 +23,18 @@ module XeroRuby::Accounting
24
23
  attr_accessor :page_size
25
24
 
26
25
 
27
- attr_accessor :total_pages
26
+ attr_accessor :page_count
28
27
 
29
28
 
30
- attr_accessor :total_rows
29
+ attr_accessor :item_count
31
30
 
32
31
  # Attribute mapping from ruby-style variable name to JSON key.
33
32
  def self.attribute_map
34
33
  {
35
- :'page' => :'Page',
36
- :'page_size' => :'PageSize',
37
- :'total_pages' => :'TotalPages',
38
- :'total_rows' => :'TotalRows'
34
+ :'page' => :'page',
35
+ :'page_size' => :'pageSize',
36
+ :'page_count' => :'pageCount',
37
+ :'item_count' => :'itemCount'
39
38
  }
40
39
  end
41
40
 
@@ -44,8 +43,8 @@ module XeroRuby::Accounting
44
43
  {
45
44
  :'page' => :'Integer',
46
45
  :'page_size' => :'Integer',
47
- :'total_pages' => :'Integer',
48
- :'total_rows' => :'Integer'
46
+ :'page_count' => :'Integer',
47
+ :'item_count' => :'Integer'
49
48
  }
50
49
  end
51
50
 
@@ -53,13 +52,13 @@ module XeroRuby::Accounting
53
52
  # @param [Hash] attributes Model attributes in the form of hash
54
53
  def initialize(attributes = {})
55
54
  if (!attributes.is_a?(Hash))
56
- fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::PageInfo` initialize method"
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Accounting::Pagination` initialize method"
57
56
  end
58
57
 
59
58
  # check to see if the attribute exists and convert string to symbol for hash key
60
59
  attributes = attributes.each_with_object({}) { |(k, v), h|
61
60
  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
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Accounting::Pagination`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
63
62
  end
64
63
  h[k.to_sym] = v
65
64
  }
@@ -72,12 +71,12 @@ module XeroRuby::Accounting
72
71
  self.page_size = attributes[:'page_size']
73
72
  end
74
73
 
75
- if attributes.key?(:'total_pages')
76
- self.total_pages = attributes[:'total_pages']
74
+ if attributes.key?(:'page_count')
75
+ self.page_count = attributes[:'page_count']
77
76
  end
78
77
 
79
- if attributes.key?(:'total_rows')
80
- self.total_rows = attributes[:'total_rows']
78
+ if attributes.key?(:'item_count')
79
+ self.item_count = attributes[:'item_count']
81
80
  end
82
81
  end
83
82
 
@@ -101,8 +100,8 @@ module XeroRuby::Accounting
101
100
  self.class == o.class &&
102
101
  page == o.page &&
103
102
  page_size == o.page_size &&
104
- total_pages == o.total_pages &&
105
- total_rows == o.total_rows
103
+ page_count == o.page_count &&
104
+ item_count == o.item_count
106
105
  end
107
106
 
108
107
  # @see the `==` method
@@ -114,7 +113,7 @@ module XeroRuby::Accounting
114
113
  # Calculates hash code according to all attributes.
115
114
  # @return [Integer] Hash code
116
115
  def hash
117
- [page, page_size, total_pages, total_rows].hash
116
+ [page, page_size, page_count, item_count].hash
118
117
  end
119
118
 
120
119
  # Builds the object from hash
@@ -17,11 +17,15 @@ module XeroRuby::Accounting
17
17
 
18
18
  class Payments
19
19
 
20
+ attr_accessor :pagination
21
+
22
+
20
23
  attr_accessor :payments
21
24
 
22
25
  # Attribute mapping from ruby-style variable name to JSON key.
23
26
  def self.attribute_map
24
27
  {
28
+ :'pagination' => :'pagination',
25
29
  :'payments' => :'Payments'
26
30
  }
27
31
  end
@@ -29,6 +33,7 @@ module XeroRuby::Accounting
29
33
  # Attribute type mapping.
30
34
  def self.openapi_types
31
35
  {
36
+ :'pagination' => :'Pagination',
32
37
  :'payments' => :'Array<Payment>'
33
38
  }
34
39
  end
@@ -48,6 +53,10 @@ module XeroRuby::Accounting
48
53
  h[k.to_sym] = v
49
54
  }
50
55
 
56
+ if attributes.key?(:'pagination')
57
+ self.pagination = attributes[:'pagination']
58
+ end
59
+
51
60
  if attributes.key?(:'payments')
52
61
  if (value = attributes[:'payments']).is_a?(Array)
53
62
  self.payments = value
@@ -73,6 +82,7 @@ module XeroRuby::Accounting
73
82
  def ==(o)
74
83
  return true if self.equal?(o)
75
84
  self.class == o.class &&
85
+ pagination == o.pagination &&
76
86
  payments == o.payments
77
87
  end
78
88
 
@@ -85,7 +95,7 @@ module XeroRuby::Accounting
85
95
  # Calculates hash code according to all attributes.
86
96
  # @return [Integer] Hash code
87
97
  def hash
88
- [payments].hash
98
+ [pagination, payments].hash
89
99
  end
90
100
 
91
101
  # Builds the object from hash
@@ -17,11 +17,15 @@ module XeroRuby::Accounting
17
17
 
18
18
  class Prepayments
19
19
 
20
+ attr_accessor :pagination
21
+
22
+
20
23
  attr_accessor :prepayments
21
24
 
22
25
  # Attribute mapping from ruby-style variable name to JSON key.
23
26
  def self.attribute_map
24
27
  {
28
+ :'pagination' => :'pagination',
25
29
  :'prepayments' => :'Prepayments'
26
30
  }
27
31
  end
@@ -29,6 +33,7 @@ module XeroRuby::Accounting
29
33
  # Attribute type mapping.
30
34
  def self.openapi_types
31
35
  {
36
+ :'pagination' => :'Pagination',
32
37
  :'prepayments' => :'Array<Prepayment>'
33
38
  }
34
39
  end
@@ -48,6 +53,10 @@ module XeroRuby::Accounting
48
53
  h[k.to_sym] = v
49
54
  }
50
55
 
56
+ if attributes.key?(:'pagination')
57
+ self.pagination = attributes[:'pagination']
58
+ end
59
+
51
60
  if attributes.key?(:'prepayments')
52
61
  if (value = attributes[:'prepayments']).is_a?(Array)
53
62
  self.prepayments = value
@@ -73,6 +82,7 @@ module XeroRuby::Accounting
73
82
  def ==(o)
74
83
  return true if self.equal?(o)
75
84
  self.class == o.class &&
85
+ pagination == o.pagination &&
76
86
  prepayments == o.prepayments
77
87
  end
78
88
 
@@ -85,7 +95,7 @@ module XeroRuby::Accounting
85
95
  # Calculates hash code according to all attributes.
86
96
  # @return [Integer] Hash code
87
97
  def hash
88
- [prepayments].hash
98
+ [pagination, prepayments].hash
89
99
  end
90
100
 
91
101
  # Builds the object from hash
@@ -17,11 +17,15 @@ module XeroRuby::Accounting
17
17
 
18
18
  class PurchaseOrders
19
19
 
20
+ attr_accessor :pagination
21
+
22
+
20
23
  attr_accessor :purchase_orders
21
24
 
22
25
  # Attribute mapping from ruby-style variable name to JSON key.
23
26
  def self.attribute_map
24
27
  {
28
+ :'pagination' => :'pagination',
25
29
  :'purchase_orders' => :'PurchaseOrders'
26
30
  }
27
31
  end
@@ -29,6 +33,7 @@ module XeroRuby::Accounting
29
33
  # Attribute type mapping.
30
34
  def self.openapi_types
31
35
  {
36
+ :'pagination' => :'Pagination',
32
37
  :'purchase_orders' => :'Array<PurchaseOrder>'
33
38
  }
34
39
  end
@@ -48,6 +53,10 @@ module XeroRuby::Accounting
48
53
  h[k.to_sym] = v
49
54
  }
50
55
 
56
+ if attributes.key?(:'pagination')
57
+ self.pagination = attributes[:'pagination']
58
+ end
59
+
51
60
  if attributes.key?(:'purchase_orders')
52
61
  if (value = attributes[:'purchase_orders']).is_a?(Array)
53
62
  self.purchase_orders = value
@@ -73,6 +82,7 @@ module XeroRuby::Accounting
73
82
  def ==(o)
74
83
  return true if self.equal?(o)
75
84
  self.class == o.class &&
85
+ pagination == o.pagination &&
76
86
  purchase_orders == o.purchase_orders
77
87
  end
78
88
 
@@ -85,7 +95,7 @@ module XeroRuby::Accounting
85
95
  # Calculates hash code according to all attributes.
86
96
  # @return [Integer] Hash code
87
97
  def hash
88
- [purchase_orders].hash
98
+ [pagination, purchase_orders].hash
89
99
  end
90
100
 
91
101
  # Builds the object from hash
@@ -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: 5.0.0
10
+ The version of the XeroOpenAPI document: 6.0.0
11
11
  =end
12
12
 
13
13
  module XeroRuby
14
- VERSION = '8.0.0'
14
+ VERSION = '9.0.0'
15
15
  end
data/lib/xero-ruby.rb CHANGED
@@ -453,15 +453,6 @@ 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'
465
456
  require 'xero-ruby/models/accounting/history_record'
466
457
  require 'xero-ruby/models/accounting/history_records'
467
458
  require 'xero-ruby/models/accounting/import_summary'
@@ -492,7 +483,7 @@ require 'xero-ruby/models/accounting/organisation'
492
483
  require 'xero-ruby/models/accounting/organisations'
493
484
  require 'xero-ruby/models/accounting/overpayment'
494
485
  require 'xero-ruby/models/accounting/overpayments'
495
- require 'xero-ruby/models/accounting/page_info'
486
+ require 'xero-ruby/models/accounting/pagination'
496
487
  require 'xero-ruby/models/accounting/payment'
497
488
  require 'xero-ruby/models/accounting/payment_delete'
498
489
  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: 8.0.0
4
+ version: 9.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-07-01 00:00:00.000000000 Z
11
+ date: 2024-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -166,15 +166,6 @@ 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
178
169
  - lib/xero-ruby/models/accounting/history_record.rb
179
170
  - lib/xero-ruby/models/accounting/history_records.rb
180
171
  - lib/xero-ruby/models/accounting/import_summary.rb
@@ -205,7 +196,7 @@ files:
205
196
  - lib/xero-ruby/models/accounting/organisations.rb
206
197
  - lib/xero-ruby/models/accounting/overpayment.rb
207
198
  - lib/xero-ruby/models/accounting/overpayments.rb
208
- - lib/xero-ruby/models/accounting/page_info.rb
199
+ - lib/xero-ruby/models/accounting/pagination.rb
209
200
  - lib/xero-ruby/models/accounting/payment.rb
210
201
  - lib/xero-ruby/models/accounting/payment_delete.rb
211
202
  - lib/xero-ruby/models/accounting/payment_service.rb
@@ -1,274 +0,0 @@
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 GetBankTransactionsResponse
19
-
20
- attr_accessor :id
21
-
22
-
23
- attr_accessor :status
24
-
25
-
26
- attr_accessor :provider_name
27
-
28
-
29
- attr_accessor :date_time_utc
30
-
31
-
32
- attr_accessor :page_info
33
-
34
-
35
- attr_accessor :bank_transactions
36
-
37
- # Attribute mapping from ruby-style variable name to JSON key.
38
- def self.attribute_map
39
- {
40
- :'id' => :'Id',
41
- :'status' => :'Status',
42
- :'provider_name' => :'ProviderName',
43
- :'date_time_utc' => :'DateTimeUTC',
44
- :'page_info' => :'PageInfo',
45
- :'bank_transactions' => :'BankTransactions'
46
- }
47
- end
48
-
49
- # Attribute type mapping.
50
- def self.openapi_types
51
- {
52
- :'id' => :'String',
53
- :'status' => :'String',
54
- :'provider_name' => :'String',
55
- :'date_time_utc' => :'String',
56
- :'page_info' => :'PageInfo',
57
- :'bank_transactions' => :'Array<BankTransaction>'
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::Accounting::GetBankTransactionsResponse` 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::Accounting::GetBankTransactionsResponse`. 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?(:'id')
77
- self.id = attributes[:'id']
78
- end
79
-
80
- if attributes.key?(:'status')
81
- self.status = attributes[:'status']
82
- end
83
-
84
- if attributes.key?(:'provider_name')
85
- self.provider_name = attributes[:'provider_name']
86
- end
87
-
88
- if attributes.key?(:'date_time_utc')
89
- self.date_time_utc = attributes[:'date_time_utc']
90
- end
91
-
92
- if attributes.key?(:'page_info')
93
- self.page_info = attributes[:'page_info']
94
- end
95
-
96
- if attributes.key?(:'bank_transactions')
97
- if (value = attributes[:'bank_transactions']).is_a?(Array)
98
- self.bank_transactions = 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
- id == o.id &&
122
- status == o.status &&
123
- provider_name == o.provider_name &&
124
- date_time_utc == o.date_time_utc &&
125
- page_info == o.page_info &&
126
- bank_transactions == o.bank_transactions
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
- [id, status, provider_name, date_time_utc, page_info, bank_transactions].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::Accounting.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