patch_ruby 1.9.0 → 1.11.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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/Gemfile +1 -2
  4. data/Gemfile.lock +40 -44
  5. data/Makefile +2 -2
  6. data/lib/patch_ruby/api/estimates_api.rb +33 -25
  7. data/lib/patch_ruby/api/orders_api.rb +21 -16
  8. data/lib/patch_ruby/api/preferences_api.rb +17 -13
  9. data/lib/patch_ruby/api/projects_api.rb +9 -7
  10. data/lib/patch_ruby/api_client.rb +51 -49
  11. data/lib/patch_ruby/api_error.rb +1 -1
  12. data/lib/patch_ruby/configuration.rb +38 -9
  13. data/lib/patch_ruby/models/allocation.rb +21 -11
  14. data/lib/patch_ruby/models/create_bitcoin_estimate_request.rb +25 -19
  15. data/lib/patch_ruby/models/create_ethereum_estimate_request.rb +26 -21
  16. data/lib/patch_ruby/models/create_flight_estimate_request.rb +323 -0
  17. data/lib/patch_ruby/models/create_mass_estimate_request.rb +22 -13
  18. data/lib/patch_ruby/models/create_order_request.rb +21 -11
  19. data/lib/patch_ruby/models/create_preference_request.rb +21 -11
  20. data/lib/patch_ruby/models/create_shipping_estimate_request.rb +371 -0
  21. data/lib/patch_ruby/models/create_success_response.rb +247 -0
  22. data/lib/patch_ruby/models/create_vehicle_estimate_request.rb +326 -0
  23. data/lib/patch_ruby/models/error_response.rb +22 -13
  24. data/lib/patch_ruby/models/estimate.rb +22 -13
  25. data/lib/patch_ruby/models/estimate_list_response.rb +22 -13
  26. data/lib/patch_ruby/models/estimate_response.rb +22 -13
  27. data/lib/patch_ruby/models/meta_index_object.rb +23 -15
  28. data/lib/patch_ruby/models/order.rb +23 -15
  29. data/lib/patch_ruby/models/order_list_response.rb +22 -13
  30. data/lib/patch_ruby/models/order_response.rb +22 -13
  31. data/lib/patch_ruby/models/photo.rb +21 -11
  32. data/lib/patch_ruby/models/preference.rb +21 -11
  33. data/lib/patch_ruby/models/preference_list_response.rb +22 -13
  34. data/lib/patch_ruby/models/preference_response.rb +22 -13
  35. data/lib/patch_ruby/models/project.rb +24 -17
  36. data/lib/patch_ruby/models/project_list_response.rb +22 -13
  37. data/lib/patch_ruby/models/project_response.rb +22 -13
  38. data/lib/patch_ruby/models/sdg.rb +21 -11
  39. data/lib/patch_ruby/models/standard.rb +21 -11
  40. data/lib/patch_ruby/version.rb +2 -2
  41. data/lib/patch_ruby.rb +5 -1
  42. data/patch_ruby.gemspec +8 -3
  43. data/spec/api_client_spec.rb +34 -13
  44. data/spec/configuration_spec.rb +1 -1
  45. data/spec/integration/estimates_spec.rb +17 -1
  46. data/spec/integration/preferences_spec.rb +1 -1
  47. data/spec/models/create_mass_estimate_request_spec.rb +1 -1
  48. data/spec/models/error_response_spec.rb +1 -1
  49. data/spec/models/estimate_list_response_spec.rb +1 -1
  50. data/spec/models/estimate_response_spec.rb +1 -1
  51. data/spec/models/estimate_spec.rb +1 -1
  52. data/spec/models/meta_index_object_spec.rb +1 -1
  53. data/spec/models/order_list_response_spec.rb +1 -1
  54. data/spec/models/order_response_spec.rb +1 -1
  55. data/spec/models/order_spec.rb +1 -1
  56. data/spec/models/preference_list_response_spec.rb +1 -1
  57. data/spec/models/preference_response_spec.rb +1 -1
  58. data/spec/models/project_list_response_spec.rb +1 -1
  59. data/spec/models/project_response_spec.rb +1 -1
  60. data/spec/models/project_spec.rb +1 -1
  61. data/spec/spec_helper.rb +69 -61
  62. metadata +56 -58
  63. data/lib/patch_ruby/.api_client.rb.un~ +0 -0
  64. data/lib/patch_ruby/.configuration.rb.un~ +0 -0
  65. data/lib/patch_ruby/.version.rb.un~ +0 -0
  66. data/lib/patch_ruby/api/.orders_api.rb.un~ +0 -0
  67. data/lib/patch_ruby/models/.create_ethereum_estimate_request.rb.un~ +0 -0
  68. data/spec/.spec_helper.rb.un~ +0 -0
  69. data/spec/integration/.estimates_spec.rb.un~ +0 -0
  70. data/spec/integration/.orders_spec.rb.un~ +0 -0
  71. data/spec/integration/.preferences_spec.rb.un~ +0 -0
  72. data/spec/integration/.projects_spec.rb.un~ +0 -0
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v1
7
7
  Contact: developers@usepatch.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ OpenAPI Generator version: 5.2.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module Patch
16
17
  class Order
@@ -82,6 +83,11 @@ module Patch
82
83
  }
83
84
  end
84
85
 
86
+ # Returns all the JSON keys this model knows about
87
+ def self.acceptable_attributes
88
+ attribute_map.values
89
+ end
90
+
85
91
  # Attribute type mapping.
86
92
  def self.openapi_types
87
93
  {
@@ -98,17 +104,15 @@ module Patch
98
104
  }
99
105
  end
100
106
 
101
- # Set with nullable attributes.
107
+ # List of attributes with nullable: true
102
108
  def self.openapi_nullable
103
- nullable_properties = Set.new
104
-
105
- nullable_properties.add("price_cents_usd")
106
-
107
- nullable_properties.add("patch_fee_cents_usd")
108
-
109
- nullable_properties
109
+ Set.new([
110
+ :'price_cents_usd',
111
+ :'patch_fee_cents_usd',
112
+ ])
110
113
  end
111
114
 
115
+
112
116
  # Allows models with corresponding API classes to delegate API operations to those API classes
113
117
  # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
114
118
  # Eg. Order.create_order delegates to OrdersApi.new.create_order
@@ -320,7 +324,9 @@ module Patch
320
324
  def build_from_hash(attributes)
321
325
  return nil unless attributes.is_a?(Hash)
322
326
  self.class.openapi_types.each_pair do |key, type|
323
- if type =~ /\AArray<(.*)>/i
327
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
328
+ self.send("#{key}=", nil)
329
+ elsif type =~ /\AArray<(.*)>/i
324
330
  # check to ensure the input is an array given that the attribute
325
331
  # is documented as an array but the input is not
326
332
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -328,7 +334,7 @@ module Patch
328
334
  end
329
335
  elsif !attributes[self.class.attribute_map[key]].nil?
330
336
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
331
- end # or else data not found in attributes(hash), not an issue as the data can be optional
337
+ end
332
338
  end
333
339
 
334
340
  self
@@ -340,8 +346,8 @@ module Patch
340
346
  # @return [Object] Deserialized data
341
347
  def _deserialize(type, value)
342
348
  case type.to_sym
343
- when :DateTime
344
- DateTime.parse(value)
349
+ when :Time
350
+ Time.parse(value)
345
351
  when :Date
346
352
  Date.parse(value)
347
353
  when :String
@@ -371,7 +377,9 @@ module Patch
371
377
  end
372
378
  end
373
379
  else # model
374
- Patch.const_get(type).build_from_hash(value)
380
+ # models (e.g. Pet) or oneOf
381
+ klass = Patch.const_get(type)
382
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
375
383
  end
376
384
  end
377
385
 
@@ -397,7 +405,7 @@ module Patch
397
405
  is_nullable = self.class.openapi_nullable.include?(attr)
398
406
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
399
407
  end
400
-
408
+
401
409
  hash[param] = _to_hash(value)
402
410
  end
403
411
  hash
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v1
7
7
  Contact: developers@usepatch.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ OpenAPI Generator version: 5.2.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module Patch
16
17
  class OrderListResponse
@@ -32,6 +33,11 @@ module Patch
32
33
  }
33
34
  end
34
35
 
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
35
41
  # Attribute type mapping.
36
42
  def self.openapi_types
37
43
  {
@@ -42,15 +48,14 @@ module Patch
42
48
  }
43
49
  end
44
50
 
45
- # Set with nullable attributes.
51
+ # List of attributes with nullable: true
46
52
  def self.openapi_nullable
47
- nullable_properties = Set.new
48
-
49
- nullable_properties.add("error")
50
-
51
- nullable_properties
53
+ Set.new([
54
+ :'error',
55
+ ])
52
56
  end
53
57
 
58
+
54
59
  # Allows models with corresponding API classes to delegate API operations to those API classes
55
60
  # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
56
61
  # Eg. Order.create_order delegates to OrdersApi.new.create_order
@@ -160,7 +165,9 @@ module Patch
160
165
  def build_from_hash(attributes)
161
166
  return nil unless attributes.is_a?(Hash)
162
167
  self.class.openapi_types.each_pair do |key, type|
163
- if type =~ /\AArray<(.*)>/i
168
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
169
+ self.send("#{key}=", nil)
170
+ elsif type =~ /\AArray<(.*)>/i
164
171
  # check to ensure the input is an array given that the attribute
165
172
  # is documented as an array but the input is not
166
173
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -168,7 +175,7 @@ module Patch
168
175
  end
169
176
  elsif !attributes[self.class.attribute_map[key]].nil?
170
177
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
171
- end # or else data not found in attributes(hash), not an issue as the data can be optional
178
+ end
172
179
  end
173
180
 
174
181
  self
@@ -180,8 +187,8 @@ module Patch
180
187
  # @return [Object] Deserialized data
181
188
  def _deserialize(type, value)
182
189
  case type.to_sym
183
- when :DateTime
184
- DateTime.parse(value)
190
+ when :Time
191
+ Time.parse(value)
185
192
  when :Date
186
193
  Date.parse(value)
187
194
  when :String
@@ -211,7 +218,9 @@ module Patch
211
218
  end
212
219
  end
213
220
  else # model
214
- Patch.const_get(type).build_from_hash(value)
221
+ # models (e.g. Pet) or oneOf
222
+ klass = Patch.const_get(type)
223
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
215
224
  end
216
225
  end
217
226
 
@@ -237,7 +246,7 @@ module Patch
237
246
  is_nullable = self.class.openapi_nullable.include?(attr)
238
247
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
239
248
  end
240
-
249
+
241
250
  hash[param] = _to_hash(value)
242
251
  end
243
252
  hash
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v1
7
7
  Contact: developers@usepatch.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ OpenAPI Generator version: 5.2.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module Patch
16
17
  class OrderResponse
@@ -29,6 +30,11 @@ module Patch
29
30
  }
30
31
  end
31
32
 
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
32
38
  # Attribute type mapping.
33
39
  def self.openapi_types
34
40
  {
@@ -38,15 +44,14 @@ module Patch
38
44
  }
39
45
  end
40
46
 
41
- # Set with nullable attributes.
47
+ # List of attributes with nullable: true
42
48
  def self.openapi_nullable
43
- nullable_properties = Set.new
44
-
45
- nullable_properties.add("error")
46
-
47
- nullable_properties
49
+ Set.new([
50
+ :'error',
51
+ ])
48
52
  end
49
53
 
54
+
50
55
  # Allows models with corresponding API classes to delegate API operations to those API classes
51
56
  # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
52
57
  # Eg. Order.create_order delegates to OrdersApi.new.create_order
@@ -144,7 +149,9 @@ module Patch
144
149
  def build_from_hash(attributes)
145
150
  return nil unless attributes.is_a?(Hash)
146
151
  self.class.openapi_types.each_pair do |key, type|
147
- if type =~ /\AArray<(.*)>/i
152
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
153
+ self.send("#{key}=", nil)
154
+ elsif type =~ /\AArray<(.*)>/i
148
155
  # check to ensure the input is an array given that the attribute
149
156
  # is documented as an array but the input is not
150
157
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -152,7 +159,7 @@ module Patch
152
159
  end
153
160
  elsif !attributes[self.class.attribute_map[key]].nil?
154
161
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
- end # or else data not found in attributes(hash), not an issue as the data can be optional
162
+ end
156
163
  end
157
164
 
158
165
  self
@@ -164,8 +171,8 @@ module Patch
164
171
  # @return [Object] Deserialized data
165
172
  def _deserialize(type, value)
166
173
  case type.to_sym
167
- when :DateTime
168
- DateTime.parse(value)
174
+ when :Time
175
+ Time.parse(value)
169
176
  when :Date
170
177
  Date.parse(value)
171
178
  when :String
@@ -195,7 +202,9 @@ module Patch
195
202
  end
196
203
  end
197
204
  else # model
198
- Patch.const_get(type).build_from_hash(value)
205
+ # models (e.g. Pet) or oneOf
206
+ klass = Patch.const_get(type)
207
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
199
208
  end
200
209
  end
201
210
 
@@ -221,7 +230,7 @@ module Patch
221
230
  is_nullable = self.class.openapi_nullable.include?(attr)
222
231
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
232
  end
224
-
233
+
225
234
  hash[param] = _to_hash(value)
226
235
  end
227
236
  hash
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v1
7
7
  Contact: developers@usepatch.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ OpenAPI Generator version: 5.2.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module Patch
16
17
  class Photo
@@ -26,6 +27,11 @@ module Patch
26
27
  }
27
28
  end
28
29
 
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
29
35
  # Attribute type mapping.
30
36
  def self.openapi_types
31
37
  {
@@ -34,13 +40,13 @@ module Patch
34
40
  }
35
41
  end
36
42
 
37
- # Set with nullable attributes.
43
+ # List of attributes with nullable: true
38
44
  def self.openapi_nullable
39
- nullable_properties = Set.new
40
-
41
- nullable_properties
45
+ Set.new([
46
+ ])
42
47
  end
43
48
 
49
+
44
50
  # Allows models with corresponding API classes to delegate API operations to those API classes
45
51
  # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
46
52
  # Eg. Order.create_order delegates to OrdersApi.new.create_order
@@ -133,7 +139,9 @@ module Patch
133
139
  def build_from_hash(attributes)
134
140
  return nil unless attributes.is_a?(Hash)
135
141
  self.class.openapi_types.each_pair do |key, type|
136
- if type =~ /\AArray<(.*)>/i
142
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
143
+ self.send("#{key}=", nil)
144
+ elsif type =~ /\AArray<(.*)>/i
137
145
  # check to ensure the input is an array given that the attribute
138
146
  # is documented as an array but the input is not
139
147
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -141,7 +149,7 @@ module Patch
141
149
  end
142
150
  elsif !attributes[self.class.attribute_map[key]].nil?
143
151
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
- end # or else data not found in attributes(hash), not an issue as the data can be optional
152
+ end
145
153
  end
146
154
 
147
155
  self
@@ -153,8 +161,8 @@ module Patch
153
161
  # @return [Object] Deserialized data
154
162
  def _deserialize(type, value)
155
163
  case type.to_sym
156
- when :DateTime
157
- DateTime.parse(value)
164
+ when :Time
165
+ Time.parse(value)
158
166
  when :Date
159
167
  Date.parse(value)
160
168
  when :String
@@ -184,7 +192,9 @@ module Patch
184
192
  end
185
193
  end
186
194
  else # model
187
- Patch.const_get(type).build_from_hash(value)
195
+ # models (e.g. Pet) or oneOf
196
+ klass = Patch.const_get(type)
197
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
198
  end
189
199
  end
190
200
 
@@ -210,7 +220,7 @@ module Patch
210
220
  is_nullable = self.class.openapi_nullable.include?(attr)
211
221
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
222
  end
213
-
223
+
214
224
  hash[param] = _to_hash(value)
215
225
  end
216
226
  hash
@@ -6,11 +6,12 @@
6
6
  The version of the OpenAPI document: v1
7
7
  Contact: developers@usepatch.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.1
9
+ OpenAPI Generator version: 5.2.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
+ require 'time'
14
15
 
15
16
  module Patch
16
17
  class Preference
@@ -32,6 +33,11 @@ module Patch
32
33
  }
33
34
  end
34
35
 
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
35
41
  # Attribute type mapping.
36
42
  def self.openapi_types
37
43
  {
@@ -41,13 +47,13 @@ module Patch
41
47
  }
42
48
  end
43
49
 
44
- # Set with nullable attributes.
50
+ # List of attributes with nullable: true
45
51
  def self.openapi_nullable
46
- nullable_properties = Set.new
47
-
48
- nullable_properties
52
+ Set.new([
53
+ ])
49
54
  end
50
55
 
56
+
51
57
  # Allows models with corresponding API classes to delegate API operations to those API classes
52
58
  # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
53
59
  # Eg. Order.create_order delegates to OrdersApi.new.create_order
@@ -150,7 +156,9 @@ module Patch
150
156
  def build_from_hash(attributes)
151
157
  return nil unless attributes.is_a?(Hash)
152
158
  self.class.openapi_types.each_pair do |key, type|
153
- if type =~ /\AArray<(.*)>/i
159
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
160
+ self.send("#{key}=", nil)
161
+ elsif type =~ /\AArray<(.*)>/i
154
162
  # check to ensure the input is an array given that the attribute
155
163
  # is documented as an array but the input is not
156
164
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -158,7 +166,7 @@ module Patch
158
166
  end
159
167
  elsif !attributes[self.class.attribute_map[key]].nil?
160
168
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
161
- end # or else data not found in attributes(hash), not an issue as the data can be optional
169
+ end
162
170
  end
163
171
 
164
172
  self
@@ -170,8 +178,8 @@ module Patch
170
178
  # @return [Object] Deserialized data
171
179
  def _deserialize(type, value)
172
180
  case type.to_sym
173
- when :DateTime
174
- DateTime.parse(value)
181
+ when :Time
182
+ Time.parse(value)
175
183
  when :Date
176
184
  Date.parse(value)
177
185
  when :String
@@ -201,7 +209,9 @@ module Patch
201
209
  end
202
210
  end
203
211
  else # model
204
- Patch.const_get(type).build_from_hash(value)
212
+ # models (e.g. Pet) or oneOf
213
+ klass = Patch.const_get(type)
214
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
215
  end
206
216
  end
207
217
 
@@ -227,7 +237,7 @@ module Patch
227
237
  is_nullable = self.class.openapi_nullable.include?(attr)
228
238
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
239
  end
230
-
240
+
231
241
  hash[param] = _to_hash(value)
232
242
  end
233
243
  hash