patch_ruby 1.9.0 → 1.10.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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/Gemfile +1 -2
  4. data/Gemfile.lock +20 -25
  5. data/lib/patch_ruby/api/estimates_api.rb +33 -25
  6. data/lib/patch_ruby/api/orders_api.rb +21 -16
  7. data/lib/patch_ruby/api/preferences_api.rb +17 -13
  8. data/lib/patch_ruby/api/projects_api.rb +9 -7
  9. data/lib/patch_ruby/api_client.rb +51 -49
  10. data/lib/patch_ruby/api_error.rb +1 -1
  11. data/lib/patch_ruby/configuration.rb +38 -9
  12. data/lib/patch_ruby/models/allocation.rb +21 -11
  13. data/lib/patch_ruby/models/create_bitcoin_estimate_request.rb +25 -19
  14. data/lib/patch_ruby/models/create_ethereum_estimate_request.rb +26 -21
  15. data/lib/patch_ruby/models/create_mass_estimate_request.rb +22 -13
  16. data/lib/patch_ruby/models/create_order_request.rb +21 -11
  17. data/lib/patch_ruby/models/create_preference_request.rb +21 -11
  18. data/lib/patch_ruby/models/error_response.rb +22 -13
  19. data/lib/patch_ruby/models/estimate.rb +22 -13
  20. data/lib/patch_ruby/models/estimate_list_response.rb +22 -13
  21. data/lib/patch_ruby/models/estimate_response.rb +22 -13
  22. data/lib/patch_ruby/models/meta_index_object.rb +23 -15
  23. data/lib/patch_ruby/models/order.rb +23 -15
  24. data/lib/patch_ruby/models/order_list_response.rb +22 -13
  25. data/lib/patch_ruby/models/order_response.rb +22 -13
  26. data/lib/patch_ruby/models/photo.rb +21 -11
  27. data/lib/patch_ruby/models/preference.rb +21 -11
  28. data/lib/patch_ruby/models/preference_list_response.rb +22 -13
  29. data/lib/patch_ruby/models/preference_response.rb +22 -13
  30. data/lib/patch_ruby/models/project.rb +24 -17
  31. data/lib/patch_ruby/models/project_list_response.rb +22 -13
  32. data/lib/patch_ruby/models/project_response.rb +22 -13
  33. data/lib/patch_ruby/models/sdg.rb +21 -11
  34. data/lib/patch_ruby/models/standard.rb +21 -11
  35. data/lib/patch_ruby/version.rb +2 -2
  36. data/lib/patch_ruby.rb +1 -1
  37. data/patch_ruby.gemspec +7 -3
  38. data/spec/api_client_spec.rb +34 -13
  39. data/spec/configuration_spec.rb +1 -1
  40. data/spec/integration/preferences_spec.rb +1 -1
  41. data/spec/models/create_mass_estimate_request_spec.rb +1 -1
  42. data/spec/models/error_response_spec.rb +1 -1
  43. data/spec/models/estimate_list_response_spec.rb +1 -1
  44. data/spec/models/estimate_response_spec.rb +1 -1
  45. data/spec/models/estimate_spec.rb +1 -1
  46. data/spec/models/meta_index_object_spec.rb +1 -1
  47. data/spec/models/order_list_response_spec.rb +1 -1
  48. data/spec/models/order_response_spec.rb +1 -1
  49. data/spec/models/order_spec.rb +1 -1
  50. data/spec/models/preference_list_response_spec.rb +1 -1
  51. data/spec/models/preference_response_spec.rb +1 -1
  52. data/spec/models/project_list_response_spec.rb +1 -1
  53. data/spec/models/project_response_spec.rb +1 -1
  54. data/spec/models/project_spec.rb +1 -1
  55. data/spec/spec_helper.rb +68 -61
  56. metadata +38 -58
  57. data/lib/patch_ruby/.api_client.rb.un~ +0 -0
  58. data/lib/patch_ruby/.configuration.rb.un~ +0 -0
  59. data/lib/patch_ruby/.version.rb.un~ +0 -0
  60. data/lib/patch_ruby/api/.orders_api.rb.un~ +0 -0
  61. data/lib/patch_ruby/models/.create_ethereum_estimate_request.rb.un~ +0 -0
  62. data/spec/.spec_helper.rb.un~ +0 -0
  63. data/spec/integration/.estimates_spec.rb.un~ +0 -0
  64. data/spec/integration/.orders_spec.rb.un~ +0 -0
  65. data/spec/integration/.preferences_spec.rb.un~ +0 -0
  66. 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 CreateEthereumEstimateRequest
@@ -35,6 +36,11 @@ module Patch
35
36
  }
36
37
  end
37
38
 
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
38
44
  # Attribute type mapping.
39
45
  def self.openapi_types
40
46
  {
@@ -46,23 +52,18 @@ module Patch
46
52
  }
47
53
  end
48
54
 
49
- # Set with nullable attributes.
55
+ # List of attributes with nullable: true
50
56
  def self.openapi_nullable
51
- nullable_properties = Set.new
52
-
53
- nullable_properties.add("timestamp")
54
-
55
- nullable_properties.add("gas_used")
56
-
57
- nullable_properties.add("transaction_value_eth_gwei")
58
-
59
- nullable_properties.add("project_id")
60
-
61
- nullable_properties.add("create_order")
62
-
63
- nullable_properties
57
+ Set.new([
58
+ :'timestamp',
59
+ :'gas_used',
60
+ :'transaction_value_eth_gwei',
61
+ :'project_id',
62
+ :'create_order'
63
+ ])
64
64
  end
65
65
 
66
+
66
67
  # Allows models with corresponding API classes to delegate API operations to those API classes
67
68
  # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
68
69
  # Eg. Order.create_order delegates to OrdersApi.new.create_order
@@ -160,7 +161,9 @@ module Patch
160
161
  def build_from_hash(attributes)
161
162
  return nil unless attributes.is_a?(Hash)
162
163
  self.class.openapi_types.each_pair do |key, type|
163
- if type =~ /\AArray<(.*)>/i
164
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
165
+ self.send("#{key}=", nil)
166
+ elsif type =~ /\AArray<(.*)>/i
164
167
  # check to ensure the input is an array given that the attribute
165
168
  # is documented as an array but the input is not
166
169
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -168,7 +171,7 @@ module Patch
168
171
  end
169
172
  elsif !attributes[self.class.attribute_map[key]].nil?
170
173
  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
174
+ end
172
175
  end
173
176
 
174
177
  self
@@ -180,8 +183,8 @@ module Patch
180
183
  # @return [Object] Deserialized data
181
184
  def _deserialize(type, value)
182
185
  case type.to_sym
183
- when :DateTime
184
- DateTime.parse(value)
186
+ when :Time
187
+ Time.parse(value)
185
188
  when :Date
186
189
  Date.parse(value)
187
190
  when :String
@@ -211,7 +214,9 @@ module Patch
211
214
  end
212
215
  end
213
216
  else # model
214
- Patch.const_get(type).build_from_hash(value)
217
+ # models (e.g. Pet) or oneOf
218
+ klass = Patch.const_get(type)
219
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
215
220
  end
216
221
  end
217
222
 
@@ -237,7 +242,7 @@ module Patch
237
242
  is_nullable = self.class.openapi_nullable.include?(attr)
238
243
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
239
244
  end
240
-
245
+
241
246
  hash[param] = _to_hash(value)
242
247
  end
243
248
  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 CreateMassEstimateRequest
@@ -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("create_order")
46
-
47
- nullable_properties
49
+ Set.new([
50
+ :'create_order',
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
@@ -167,7 +172,9 @@ module Patch
167
172
  def build_from_hash(attributes)
168
173
  return nil unless attributes.is_a?(Hash)
169
174
  self.class.openapi_types.each_pair do |key, type|
170
- if type =~ /\AArray<(.*)>/i
175
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
176
+ self.send("#{key}=", nil)
177
+ elsif type =~ /\AArray<(.*)>/i
171
178
  # check to ensure the input is an array given that the attribute
172
179
  # is documented as an array but the input is not
173
180
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -175,7 +182,7 @@ module Patch
175
182
  end
176
183
  elsif !attributes[self.class.attribute_map[key]].nil?
177
184
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
178
- end # or else data not found in attributes(hash), not an issue as the data can be optional
185
+ end
179
186
  end
180
187
 
181
188
  self
@@ -187,8 +194,8 @@ module Patch
187
194
  # @return [Object] Deserialized data
188
195
  def _deserialize(type, value)
189
196
  case type.to_sym
190
- when :DateTime
191
- DateTime.parse(value)
197
+ when :Time
198
+ Time.parse(value)
192
199
  when :Date
193
200
  Date.parse(value)
194
201
  when :String
@@ -218,7 +225,9 @@ module Patch
218
225
  end
219
226
  end
220
227
  else # model
221
- Patch.const_get(type).build_from_hash(value)
228
+ # models (e.g. Pet) or oneOf
229
+ klass = Patch.const_get(type)
230
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
222
231
  end
223
232
  end
224
233
 
@@ -244,7 +253,7 @@ module Patch
244
253
  is_nullable = self.class.openapi_nullable.include?(attr)
245
254
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
246
255
  end
247
-
256
+
248
257
  hash[param] = _to_hash(value)
249
258
  end
250
259
  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 CreateOrderRequest
@@ -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,13 +48,13 @@ 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
53
+ Set.new([
54
+ ])
50
55
  end
51
56
 
57
+
52
58
  # Allows models with corresponding API classes to delegate API operations to those API classes
53
59
  # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
54
60
  # Eg. Order.create_order delegates to OrdersApi.new.create_order
@@ -180,7 +186,9 @@ module Patch
180
186
  def build_from_hash(attributes)
181
187
  return nil unless attributes.is_a?(Hash)
182
188
  self.class.openapi_types.each_pair do |key, type|
183
- if type =~ /\AArray<(.*)>/i
189
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
190
+ self.send("#{key}=", nil)
191
+ elsif type =~ /\AArray<(.*)>/i
184
192
  # check to ensure the input is an array given that the attribute
185
193
  # is documented as an array but the input is not
186
194
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -188,7 +196,7 @@ module Patch
188
196
  end
189
197
  elsif !attributes[self.class.attribute_map[key]].nil?
190
198
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
191
- end # or else data not found in attributes(hash), not an issue as the data can be optional
199
+ end
192
200
  end
193
201
 
194
202
  self
@@ -200,8 +208,8 @@ module Patch
200
208
  # @return [Object] Deserialized data
201
209
  def _deserialize(type, value)
202
210
  case type.to_sym
203
- when :DateTime
204
- DateTime.parse(value)
211
+ when :Time
212
+ Time.parse(value)
205
213
  when :Date
206
214
  Date.parse(value)
207
215
  when :String
@@ -231,7 +239,9 @@ module Patch
231
239
  end
232
240
  end
233
241
  else # model
234
- Patch.const_get(type).build_from_hash(value)
242
+ # models (e.g. Pet) or oneOf
243
+ klass = Patch.const_get(type)
244
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
235
245
  end
236
246
  end
237
247
 
@@ -257,7 +267,7 @@ module Patch
257
267
  is_nullable = self.class.openapi_nullable.include?(attr)
258
268
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
259
269
  end
260
-
270
+
261
271
  hash[param] = _to_hash(value)
262
272
  end
263
273
  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 CreatePreferenceRequest
@@ -23,6 +24,11 @@ module Patch
23
24
  }
24
25
  end
25
26
 
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
26
32
  # Attribute type mapping.
27
33
  def self.openapi_types
28
34
  {
@@ -30,13 +36,13 @@ module Patch
30
36
  }
31
37
  end
32
38
 
33
- # Set with nullable attributes.
39
+ # List of attributes with nullable: true
34
40
  def self.openapi_nullable
35
- nullable_properties = Set.new
36
-
37
- nullable_properties
41
+ Set.new([
42
+ ])
38
43
  end
39
44
 
45
+
40
46
  # Allows models with corresponding API classes to delegate API operations to those API classes
41
47
  # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
42
48
  # Eg. Order.create_order delegates to OrdersApi.new.create_order
@@ -119,7 +125,9 @@ module Patch
119
125
  def build_from_hash(attributes)
120
126
  return nil unless attributes.is_a?(Hash)
121
127
  self.class.openapi_types.each_pair do |key, type|
122
- if type =~ /\AArray<(.*)>/i
128
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
129
+ self.send("#{key}=", nil)
130
+ elsif type =~ /\AArray<(.*)>/i
123
131
  # check to ensure the input is an array given that the attribute
124
132
  # is documented as an array but the input is not
125
133
  if attributes[self.class.attribute_map[key]].is_a?(Array)
@@ -127,7 +135,7 @@ module Patch
127
135
  end
128
136
  elsif !attributes[self.class.attribute_map[key]].nil?
129
137
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
- end # or else data not found in attributes(hash), not an issue as the data can be optional
138
+ end
131
139
  end
132
140
 
133
141
  self
@@ -139,8 +147,8 @@ module Patch
139
147
  # @return [Object] Deserialized data
140
148
  def _deserialize(type, value)
141
149
  case type.to_sym
142
- when :DateTime
143
- DateTime.parse(value)
150
+ when :Time
151
+ Time.parse(value)
144
152
  when :Date
145
153
  Date.parse(value)
146
154
  when :String
@@ -170,7 +178,9 @@ module Patch
170
178
  end
171
179
  end
172
180
  else # model
173
- Patch.const_get(type).build_from_hash(value)
181
+ # models (e.g. Pet) or oneOf
182
+ klass = Patch.const_get(type)
183
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
174
184
  end
175
185
  end
176
186
 
@@ -196,7 +206,7 @@ module Patch
196
206
  is_nullable = self.class.openapi_nullable.include?(attr)
197
207
  next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
208
  end
199
-
209
+
200
210
  hash[param] = _to_hash(value)
201
211
  end
202
212
  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 ErrorResponse
@@ -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("data")
46
-
47
- nullable_properties
49
+ Set.new([
50
+ :'data'
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