patch_ruby 1.24.2 → 2.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/patch_ruby/api/estimates_api.rb +72 -2
- data/lib/patch_ruby/api/order_line_items_api.rb +269 -0
- data/lib/patch_ruby/api/orders_api.rb +99 -4
- data/lib/patch_ruby/api/projects_api.rb +12 -2
- data/lib/patch_ruby/api/technology_types_api.rb +7 -2
- data/lib/patch_ruby/api_client.rb +3 -3
- data/lib/patch_ruby/api_error.rb +2 -2
- data/lib/patch_ruby/configuration.rb +2 -2
- data/lib/patch_ruby/models/create_air_shipping_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_bitcoin_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_ecommerce_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_ethereum_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_flight_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_hotel_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_mass_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_order_line_item_request.rb +375 -0
- data/lib/patch_ruby/models/create_order_request.rb +8 -67
- data/lib/patch_ruby/models/create_rail_shipping_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_road_shipping_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_sea_shipping_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_shipping_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_success_response.rb +2 -2
- data/lib/patch_ruby/models/create_vehicle_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/delete_order_line_item_response.rb +257 -0
- data/lib/patch_ruby/models/delete_order_response.rb +257 -0
- data/lib/patch_ruby/models/error_response.rb +2 -2
- data/lib/patch_ruby/models/estimate.rb +2 -2
- data/lib/patch_ruby/models/estimate_list_response.rb +2 -2
- data/lib/patch_ruby/models/estimate_response.rb +2 -2
- data/lib/patch_ruby/models/highlight.rb +2 -2
- data/lib/patch_ruby/models/inventory.rb +2 -2
- data/lib/patch_ruby/models/meta_index_object.rb +2 -2
- data/lib/patch_ruby/models/order.rb +11 -115
- data/lib/patch_ruby/models/order_issued_to.rb +2 -2
- data/lib/patch_ruby/models/{order_inventory.rb → order_line_item.rb} +19 -9
- data/lib/patch_ruby/models/{order_inventory_project.rb → order_line_item_project.rb} +7 -7
- data/lib/patch_ruby/models/{allocation.rb → order_line_item_response.rb} +33 -40
- data/lib/patch_ruby/models/order_list_response.rb +2 -2
- data/lib/patch_ruby/models/order_response.rb +2 -2
- data/lib/patch_ruby/models/parent_technology_type.rb +2 -2
- data/lib/patch_ruby/models/photo.rb +2 -2
- data/lib/patch_ruby/models/place_order_request.rb +2 -2
- data/lib/patch_ruby/models/project.rb +13 -53
- data/lib/patch_ruby/models/project_list_response.rb +2 -2
- data/lib/patch_ruby/models/project_response.rb +2 -2
- data/lib/patch_ruby/models/sdg.rb +2 -2
- data/lib/patch_ruby/models/standard.rb +2 -2
- data/lib/patch_ruby/models/technology_type.rb +2 -2
- data/lib/patch_ruby/models/technology_type_list_response.rb +2 -2
- data/lib/patch_ruby/models/update_order_line_item_request.rb +366 -0
- data/lib/patch_ruby/version.rb +3 -3
- data/lib/patch_ruby.rb +10 -5
- data/patch_ruby.gemspec +2 -2
- data/spec/api/order_line_items_api_spec.rb +78 -0
- data/spec/api_client_spec.rb +2 -2
- data/spec/configuration_spec.rb +2 -2
- data/spec/factories/create_order_requests.rb +4 -2
- data/spec/factories/orders.rb +5 -4
- data/spec/factories/projects.rb +1 -4
- data/spec/integration/orders_spec.rb +85 -44
- data/spec/integration/projects_spec.rb +2 -4
- data/spec/models/create_order_request_spec.rb +10 -3
- data/spec/models/order_spec.rb +8 -23
- data/spec/models/project_spec.rb +1 -4
- data/spec/spec_helper.rb +2 -2
- metadata +34 -31
- data/spec/factories/allocations.rb +0 -7
- data/spec/models/allocation_spec.rb +0 -59
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#Patch API
|
2
|
+
#Patch API V2
|
3
3
|
|
4
4
|
#The core API used to integrate with Patch's service
|
5
5
|
|
6
|
-
The version of the OpenAPI document:
|
6
|
+
The version of the OpenAPI document: 2
|
7
7
|
Contact: engineering@usepatch.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 5.3.1
|
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#Patch API
|
2
|
+
#Patch API V2
|
3
3
|
|
4
4
|
#The core API used to integrate with Patch's service
|
5
5
|
|
6
|
-
The version of the OpenAPI document:
|
6
|
+
The version of the OpenAPI document: 2
|
7
7
|
Contact: engineering@usepatch.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 5.3.1
|
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#Patch API
|
2
|
+
#Patch API V2
|
3
3
|
|
4
4
|
#The core API used to integrate with Patch's service
|
5
5
|
|
6
|
-
The version of the OpenAPI document:
|
6
|
+
The version of the OpenAPI document: 2
|
7
7
|
Contact: engineering@usepatch.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 5.3.1
|
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#Patch API
|
2
|
+
#Patch API V2
|
3
3
|
|
4
4
|
#The core API used to integrate with Patch's service
|
5
5
|
|
6
|
-
The version of the OpenAPI document:
|
6
|
+
The version of the OpenAPI document: 2
|
7
7
|
Contact: engineering@usepatch.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 5.3.1
|
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#Patch API
|
2
|
+
#Patch API V2
|
3
3
|
|
4
4
|
#The core API used to integrate with Patch's service
|
5
5
|
|
6
|
-
The version of the OpenAPI document:
|
6
|
+
The version of the OpenAPI document: 2
|
7
7
|
Contact: engineering@usepatch.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 5.3.1
|
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#Patch API
|
2
|
+
#Patch API V2
|
3
3
|
|
4
4
|
#The core API used to integrate with Patch's service
|
5
5
|
|
6
|
-
The version of the OpenAPI document:
|
6
|
+
The version of the OpenAPI document: 2
|
7
7
|
Contact: engineering@usepatch.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 5.3.1
|
@@ -0,0 +1,375 @@
|
|
1
|
+
=begin
|
2
|
+
#Patch API V2
|
3
|
+
|
4
|
+
#The core API used to integrate with Patch's service
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2
|
7
|
+
Contact: engineering@usepatch.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.3.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Patch
|
17
|
+
class CreateOrderLineItemRequest
|
18
|
+
attr_accessor :project_id
|
19
|
+
|
20
|
+
attr_accessor :vintage_year
|
21
|
+
|
22
|
+
attr_accessor :price
|
23
|
+
|
24
|
+
attr_accessor :currency
|
25
|
+
|
26
|
+
attr_accessor :amount
|
27
|
+
|
28
|
+
attr_accessor :unit
|
29
|
+
|
30
|
+
class EnumAttributeValidator
|
31
|
+
attr_reader :datatype
|
32
|
+
attr_reader :allowable_values
|
33
|
+
|
34
|
+
def initialize(datatype, allowable_values)
|
35
|
+
@allowable_values = allowable_values.map do |value|
|
36
|
+
case datatype.to_s
|
37
|
+
when /Integer/i
|
38
|
+
value.to_i
|
39
|
+
when /Float/i
|
40
|
+
value.to_f
|
41
|
+
else
|
42
|
+
value
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def valid?(value)
|
48
|
+
!value || allowable_values.include?(value)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
53
|
+
def self.attribute_map
|
54
|
+
{
|
55
|
+
:'project_id' => :'project_id',
|
56
|
+
:'vintage_year' => :'vintage_year',
|
57
|
+
:'price' => :'price',
|
58
|
+
:'currency' => :'currency',
|
59
|
+
:'amount' => :'amount',
|
60
|
+
:'unit' => :'unit'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Returns all the JSON keys this model knows about
|
65
|
+
def self.acceptable_attributes
|
66
|
+
attribute_map.values
|
67
|
+
end
|
68
|
+
|
69
|
+
# Attribute type mapping.
|
70
|
+
def self.openapi_types
|
71
|
+
{
|
72
|
+
:'project_id' => :'String',
|
73
|
+
:'vintage_year' => :'Integer',
|
74
|
+
:'price' => :'Integer',
|
75
|
+
:'currency' => :'String',
|
76
|
+
:'amount' => :'Integer',
|
77
|
+
:'unit' => :'String'
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
# List of attributes with nullable: true
|
82
|
+
def self.openapi_nullable
|
83
|
+
Set.new([
|
84
|
+
:'vintage_year',
|
85
|
+
:'price',
|
86
|
+
:'currency',
|
87
|
+
:'amount',
|
88
|
+
:'unit'
|
89
|
+
])
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
# Allows models with corresponding API classes to delegate API operations to those API classes
|
94
|
+
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
95
|
+
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
96
|
+
def self.method_missing(message, *args, &block)
|
97
|
+
if Object.const_defined?('Patch::CreateOrderLineItemRequestsApi::OPERATIONS') && Patch::CreateOrderLineItemRequestsApi::OPERATIONS.include?(message)
|
98
|
+
Patch::CreateOrderLineItemRequestsApi.new.send(message, *args)
|
99
|
+
else
|
100
|
+
super
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
# Initializes the object
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
106
|
+
def initialize(attributes = {})
|
107
|
+
if (!attributes.is_a?(Hash))
|
108
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::CreateOrderLineItemRequest` initialize method"
|
109
|
+
end
|
110
|
+
|
111
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
112
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
113
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
114
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::CreateOrderLineItemRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
115
|
+
end
|
116
|
+
h[k.to_sym] = v
|
117
|
+
}
|
118
|
+
|
119
|
+
if attributes.key?(:'project_id')
|
120
|
+
self.project_id = attributes[:'project_id']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.key?(:'vintage_year')
|
124
|
+
self.vintage_year = attributes[:'vintage_year']
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.key?(:'price')
|
128
|
+
self.price = attributes[:'price']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.key?(:'currency')
|
132
|
+
self.currency = attributes[:'currency']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.key?(:'amount')
|
136
|
+
self.amount = attributes[:'amount']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.key?(:'unit')
|
140
|
+
self.unit = attributes[:'unit']
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
145
|
+
# @return Array for valid properties with the reasons
|
146
|
+
def list_invalid_properties
|
147
|
+
invalid_properties = Array.new
|
148
|
+
if !@vintage_year.nil? && @vintage_year > 2100
|
149
|
+
invalid_properties.push('invalid value for "vintage_year", must be smaller than or equal to 2100.')
|
150
|
+
end
|
151
|
+
|
152
|
+
if !@vintage_year.nil? && @vintage_year < 1900
|
153
|
+
invalid_properties.push('invalid value for "vintage_year", must be greater than or equal to 1900.')
|
154
|
+
end
|
155
|
+
|
156
|
+
if !@price.nil? && @price < 2
|
157
|
+
invalid_properties.push('invalid value for "price", must be greater than or equal to 2.')
|
158
|
+
end
|
159
|
+
|
160
|
+
if !@amount.nil? && @amount > 100000000000
|
161
|
+
invalid_properties.push('invalid value for "amount", must be smaller than or equal to 100000000000.')
|
162
|
+
end
|
163
|
+
|
164
|
+
if !@amount.nil? && @amount < 0
|
165
|
+
invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.')
|
166
|
+
end
|
167
|
+
|
168
|
+
invalid_properties
|
169
|
+
end
|
170
|
+
|
171
|
+
# Check to see if the all the properties in the model are valid
|
172
|
+
# @return true if the model is valid
|
173
|
+
def valid?
|
174
|
+
return false if !@vintage_year.nil? && @vintage_year > 2100
|
175
|
+
return false if !@vintage_year.nil? && @vintage_year < 1900
|
176
|
+
return false if !@price.nil? && @price < 2
|
177
|
+
return false if !@amount.nil? && @amount > 100000000000
|
178
|
+
return false if !@amount.nil? && @amount < 0
|
179
|
+
unit_validator = EnumAttributeValidator.new('String', ["g", "Wh"])
|
180
|
+
return false unless unit_validator.valid?(@unit)
|
181
|
+
true
|
182
|
+
end
|
183
|
+
|
184
|
+
# Custom attribute writer method with validation
|
185
|
+
# @param [Object] vintage_year Value to be assigned
|
186
|
+
def vintage_year=(vintage_year)
|
187
|
+
if !vintage_year.nil? && vintage_year > 2100
|
188
|
+
fail ArgumentError, 'invalid value for "vintage_year", must be smaller than or equal to 2100.'
|
189
|
+
end
|
190
|
+
|
191
|
+
if !vintage_year.nil? && vintage_year < 1900
|
192
|
+
fail ArgumentError, 'invalid value for "vintage_year", must be greater than or equal to 1900.'
|
193
|
+
end
|
194
|
+
|
195
|
+
@vintage_year = vintage_year
|
196
|
+
end
|
197
|
+
|
198
|
+
# Custom attribute writer method with validation
|
199
|
+
# @param [Object] price Value to be assigned
|
200
|
+
def price=(price)
|
201
|
+
if !price.nil? && price < 2
|
202
|
+
fail ArgumentError, 'invalid value for "price", must be greater than or equal to 2.'
|
203
|
+
end
|
204
|
+
|
205
|
+
@price = price
|
206
|
+
end
|
207
|
+
|
208
|
+
# Custom attribute writer method with validation
|
209
|
+
# @param [Object] amount Value to be assigned
|
210
|
+
def amount=(amount)
|
211
|
+
if !amount.nil? && amount > 100000000000
|
212
|
+
fail ArgumentError, 'invalid value for "amount", must be smaller than or equal to 100000000000.'
|
213
|
+
end
|
214
|
+
|
215
|
+
if !amount.nil? && amount < 0
|
216
|
+
fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 0.'
|
217
|
+
end
|
218
|
+
|
219
|
+
@amount = amount
|
220
|
+
end
|
221
|
+
|
222
|
+
# Custom attribute writer method checking allowed values (enum).
|
223
|
+
# @param [Object] unit Object to be assigned
|
224
|
+
def unit=(unit)
|
225
|
+
validator = EnumAttributeValidator.new('String', ["g", "Wh"])
|
226
|
+
unless validator.valid?(unit)
|
227
|
+
fail ArgumentError, "invalid value for \"unit\", must be one of #{validator.allowable_values}."
|
228
|
+
end
|
229
|
+
@unit = unit
|
230
|
+
end
|
231
|
+
|
232
|
+
# Checks equality by comparing each attribute.
|
233
|
+
# @param [Object] Object to be compared
|
234
|
+
def ==(o)
|
235
|
+
return true if self.equal?(o)
|
236
|
+
self.class == o.class &&
|
237
|
+
project_id == o.project_id &&
|
238
|
+
vintage_year == o.vintage_year &&
|
239
|
+
price == o.price &&
|
240
|
+
currency == o.currency &&
|
241
|
+
amount == o.amount &&
|
242
|
+
unit == o.unit
|
243
|
+
end
|
244
|
+
|
245
|
+
# @see the `==` method
|
246
|
+
# @param [Object] Object to be compared
|
247
|
+
def eql?(o)
|
248
|
+
self == o
|
249
|
+
end
|
250
|
+
|
251
|
+
# Calculates hash code according to all attributes.
|
252
|
+
# @return [Integer] Hash code
|
253
|
+
def hash
|
254
|
+
[project_id, vintage_year, price, currency, amount, unit].hash
|
255
|
+
end
|
256
|
+
|
257
|
+
# Builds the object from hash
|
258
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
259
|
+
# @return [Object] Returns the model itself
|
260
|
+
def self.build_from_hash(attributes)
|
261
|
+
new.build_from_hash(attributes)
|
262
|
+
end
|
263
|
+
|
264
|
+
# Builds the object from hash
|
265
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
266
|
+
# @return [Object] Returns the model itself
|
267
|
+
def build_from_hash(attributes)
|
268
|
+
return nil unless attributes.is_a?(Hash)
|
269
|
+
self.class.openapi_types.each_pair do |key, type|
|
270
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
271
|
+
self.send("#{key}=", nil)
|
272
|
+
elsif type =~ /\AArray<(.*)>/i
|
273
|
+
# check to ensure the input is an array given that the attribute
|
274
|
+
# is documented as an array but the input is not
|
275
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
276
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
277
|
+
end
|
278
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
279
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
self
|
284
|
+
end
|
285
|
+
|
286
|
+
# Deserializes the data based on type
|
287
|
+
# @param string type Data type
|
288
|
+
# @param string value Value to be deserialized
|
289
|
+
# @return [Object] Deserialized data
|
290
|
+
def _deserialize(type, value)
|
291
|
+
case type.to_sym
|
292
|
+
when :Time
|
293
|
+
Time.parse(value)
|
294
|
+
when :Date
|
295
|
+
Date.parse(value)
|
296
|
+
when :String
|
297
|
+
value.to_s
|
298
|
+
when :Integer
|
299
|
+
value.to_i
|
300
|
+
when :Float
|
301
|
+
value.to_f
|
302
|
+
when :Boolean
|
303
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
304
|
+
true
|
305
|
+
else
|
306
|
+
false
|
307
|
+
end
|
308
|
+
when :Object
|
309
|
+
# generic object (usually a Hash), return directly
|
310
|
+
value
|
311
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
312
|
+
inner_type = Regexp.last_match[:inner_type]
|
313
|
+
value.map { |v| _deserialize(inner_type, v) }
|
314
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
315
|
+
k_type = Regexp.last_match[:k_type]
|
316
|
+
v_type = Regexp.last_match[:v_type]
|
317
|
+
{}.tap do |hash|
|
318
|
+
value.each do |k, v|
|
319
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
320
|
+
end
|
321
|
+
end
|
322
|
+
else # model
|
323
|
+
# models (e.g. Pet) or oneOf
|
324
|
+
klass = Patch.const_get(type)
|
325
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
# Returns the string representation of the object
|
330
|
+
# @return [String] String presentation of the object
|
331
|
+
def to_s
|
332
|
+
to_hash.to_s
|
333
|
+
end
|
334
|
+
|
335
|
+
# to_body is an alias to to_hash (backward compatibility)
|
336
|
+
# @return [Hash] Returns the object in the form of hash
|
337
|
+
def to_body
|
338
|
+
to_hash
|
339
|
+
end
|
340
|
+
|
341
|
+
# Returns the object in the form of hash
|
342
|
+
# @return [Hash] Returns the object in the form of hash
|
343
|
+
def to_hash
|
344
|
+
hash = {}
|
345
|
+
self.class.attribute_map.each_pair do |attr, param|
|
346
|
+
value = self.send(attr)
|
347
|
+
if value.nil?
|
348
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
349
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
350
|
+
end
|
351
|
+
|
352
|
+
hash[param] = _to_hash(value)
|
353
|
+
end
|
354
|
+
hash
|
355
|
+
end
|
356
|
+
|
357
|
+
# Outputs non-array value in the form of hash
|
358
|
+
# For object, use to_hash. Otherwise, just return the value
|
359
|
+
# @param [Object] value Any valid value
|
360
|
+
# @return [Hash] Returns the value in the form of hash
|
361
|
+
def _to_hash(value)
|
362
|
+
if value.is_a?(Array)
|
363
|
+
value.compact.map { |v| _to_hash(v) }
|
364
|
+
elsif value.is_a?(Hash)
|
365
|
+
{}.tap do |hash|
|
366
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
367
|
+
end
|
368
|
+
elsif value.respond_to? :to_hash
|
369
|
+
value.to_hash
|
370
|
+
else
|
371
|
+
value
|
372
|
+
end
|
373
|
+
end
|
374
|
+
end
|
375
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#Patch API
|
2
|
+
#Patch API V2
|
3
3
|
|
4
4
|
#The core API used to integrate with Patch's service
|
5
5
|
|
6
|
-
The version of the OpenAPI document:
|
6
|
+
The version of the OpenAPI document: 2
|
7
7
|
Contact: engineering@usepatch.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 5.3.1
|
@@ -15,10 +15,6 @@ require 'time'
|
|
15
15
|
|
16
16
|
module Patch
|
17
17
|
class CreateOrderRequest
|
18
|
-
attr_accessor :mass_g
|
19
|
-
|
20
|
-
attr_accessor :total_price_cents_usd
|
21
|
-
|
22
18
|
attr_accessor :project_id
|
23
19
|
|
24
20
|
attr_accessor :metadata
|
@@ -62,8 +58,6 @@ module Patch
|
|
62
58
|
# Attribute mapping from ruby-style variable name to JSON key.
|
63
59
|
def self.attribute_map
|
64
60
|
{
|
65
|
-
:'mass_g' => :'mass_g',
|
66
|
-
:'total_price_cents_usd' => :'total_price_cents_usd',
|
67
61
|
:'project_id' => :'project_id',
|
68
62
|
:'metadata' => :'metadata',
|
69
63
|
:'state' => :'state',
|
@@ -84,8 +78,6 @@ module Patch
|
|
84
78
|
# Attribute type mapping.
|
85
79
|
def self.openapi_types
|
86
80
|
{
|
87
|
-
:'mass_g' => :'Integer',
|
88
|
-
:'total_price_cents_usd' => :'Integer',
|
89
81
|
:'project_id' => :'String',
|
90
82
|
:'metadata' => :'Object',
|
91
83
|
:'state' => :'String',
|
@@ -101,8 +93,6 @@ module Patch
|
|
101
93
|
# List of attributes with nullable: true
|
102
94
|
def self.openapi_nullable
|
103
95
|
Set.new([
|
104
|
-
:'mass_g',
|
105
|
-
:'total_price_cents_usd',
|
106
96
|
:'project_id',
|
107
97
|
:'metadata',
|
108
98
|
:'state',
|
@@ -141,14 +131,6 @@ module Patch
|
|
141
131
|
h[k.to_sym] = v
|
142
132
|
}
|
143
133
|
|
144
|
-
if attributes.key?(:'mass_g')
|
145
|
-
self.mass_g = attributes[:'mass_g']
|
146
|
-
end
|
147
|
-
|
148
|
-
if attributes.key?(:'total_price_cents_usd')
|
149
|
-
self.total_price_cents_usd = attributes[:'total_price_cents_usd']
|
150
|
-
end
|
151
|
-
|
152
134
|
if attributes.key?(:'project_id')
|
153
135
|
self.project_id = attributes[:'project_id']
|
154
136
|
end
|
@@ -190,18 +172,6 @@ module Patch
|
|
190
172
|
# @return Array for valid properties with the reasons
|
191
173
|
def list_invalid_properties
|
192
174
|
invalid_properties = Array.new
|
193
|
-
if !@mass_g.nil? && @mass_g > 100000000000
|
194
|
-
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 100000000000.')
|
195
|
-
end
|
196
|
-
|
197
|
-
if !@mass_g.nil? && @mass_g < 0
|
198
|
-
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 0.')
|
199
|
-
end
|
200
|
-
|
201
|
-
if !@total_price_cents_usd.nil? && @total_price_cents_usd < 1
|
202
|
-
invalid_properties.push('invalid value for "total_price_cents_usd", must be greater than or equal to 1.')
|
203
|
-
end
|
204
|
-
|
205
175
|
if !@vintage_year.nil? && @vintage_year > 2100
|
206
176
|
invalid_properties.push('invalid value for "vintage_year", must be smaller than or equal to 2100.')
|
207
177
|
end
|
@@ -210,8 +180,8 @@ module Patch
|
|
210
180
|
invalid_properties.push('invalid value for "vintage_year", must be greater than or equal to 1900.')
|
211
181
|
end
|
212
182
|
|
213
|
-
if !@total_price.nil? && @total_price <
|
214
|
-
invalid_properties.push('invalid value for "total_price", must be greater than or equal to
|
183
|
+
if !@total_price.nil? && @total_price < 2
|
184
|
+
invalid_properties.push('invalid value for "total_price", must be greater than or equal to 2.')
|
215
185
|
end
|
216
186
|
|
217
187
|
if !@amount.nil? && @amount > 100000000000
|
@@ -228,14 +198,11 @@ module Patch
|
|
228
198
|
# Check to see if the all the properties in the model are valid
|
229
199
|
# @return true if the model is valid
|
230
200
|
def valid?
|
231
|
-
return false if !@mass_g.nil? && @mass_g > 100000000000
|
232
|
-
return false if !@mass_g.nil? && @mass_g < 0
|
233
|
-
return false if !@total_price_cents_usd.nil? && @total_price_cents_usd < 1
|
234
201
|
state_validator = EnumAttributeValidator.new('String', ["draft", "reserved", "placed"])
|
235
202
|
return false unless state_validator.valid?(@state)
|
236
203
|
return false if !@vintage_year.nil? && @vintage_year > 2100
|
237
204
|
return false if !@vintage_year.nil? && @vintage_year < 1900
|
238
|
-
return false if !@total_price.nil? && @total_price <
|
205
|
+
return false if !@total_price.nil? && @total_price < 2
|
239
206
|
return false if !@amount.nil? && @amount > 100000000000
|
240
207
|
return false if !@amount.nil? && @amount < 0
|
241
208
|
unit_validator = EnumAttributeValidator.new('String', ["g", "Wh"])
|
@@ -243,30 +210,6 @@ module Patch
|
|
243
210
|
true
|
244
211
|
end
|
245
212
|
|
246
|
-
# Custom attribute writer method with validation
|
247
|
-
# @param [Object] mass_g Value to be assigned
|
248
|
-
def mass_g=(mass_g)
|
249
|
-
if !mass_g.nil? && mass_g > 100000000000
|
250
|
-
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 100000000000.'
|
251
|
-
end
|
252
|
-
|
253
|
-
if !mass_g.nil? && mass_g < 0
|
254
|
-
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 0.'
|
255
|
-
end
|
256
|
-
|
257
|
-
@mass_g = mass_g
|
258
|
-
end
|
259
|
-
|
260
|
-
# Custom attribute writer method with validation
|
261
|
-
# @param [Object] total_price_cents_usd Value to be assigned
|
262
|
-
def total_price_cents_usd=(total_price_cents_usd)
|
263
|
-
if !total_price_cents_usd.nil? && total_price_cents_usd < 1
|
264
|
-
fail ArgumentError, 'invalid value for "total_price_cents_usd", must be greater than or equal to 1.'
|
265
|
-
end
|
266
|
-
|
267
|
-
@total_price_cents_usd = total_price_cents_usd
|
268
|
-
end
|
269
|
-
|
270
213
|
# Custom attribute writer method checking allowed values (enum).
|
271
214
|
# @param [Object] state Object to be assigned
|
272
215
|
def state=(state)
|
@@ -294,8 +237,8 @@ module Patch
|
|
294
237
|
# Custom attribute writer method with validation
|
295
238
|
# @param [Object] total_price Value to be assigned
|
296
239
|
def total_price=(total_price)
|
297
|
-
if !total_price.nil? && total_price <
|
298
|
-
fail ArgumentError, 'invalid value for "total_price", must be greater than or equal to
|
240
|
+
if !total_price.nil? && total_price < 2
|
241
|
+
fail ArgumentError, 'invalid value for "total_price", must be greater than or equal to 2.'
|
299
242
|
end
|
300
243
|
|
301
244
|
@total_price = total_price
|
@@ -330,8 +273,6 @@ module Patch
|
|
330
273
|
def ==(o)
|
331
274
|
return true if self.equal?(o)
|
332
275
|
self.class == o.class &&
|
333
|
-
mass_g == o.mass_g &&
|
334
|
-
total_price_cents_usd == o.total_price_cents_usd &&
|
335
276
|
project_id == o.project_id &&
|
336
277
|
metadata == o.metadata &&
|
337
278
|
state == o.state &&
|
@@ -352,7 +293,7 @@ module Patch
|
|
352
293
|
# Calculates hash code according to all attributes.
|
353
294
|
# @return [Integer] Hash code
|
354
295
|
def hash
|
355
|
-
[
|
296
|
+
[project_id, metadata, state, vintage_year, total_price, currency, amount, unit, issued_to].hash
|
356
297
|
end
|
357
298
|
|
358
299
|
# Builds the object from hash
|
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#Patch API
|
2
|
+
#Patch API V2
|
3
3
|
|
4
4
|
#The core API used to integrate with Patch's service
|
5
5
|
|
6
|
-
The version of the OpenAPI document:
|
6
|
+
The version of the OpenAPI document: 2
|
7
7
|
Contact: engineering@usepatch.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 5.3.1
|
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#Patch API
|
2
|
+
#Patch API V2
|
3
3
|
|
4
4
|
#The core API used to integrate with Patch's service
|
5
5
|
|
6
|
-
The version of the OpenAPI document:
|
6
|
+
The version of the OpenAPI document: 2
|
7
7
|
Contact: engineering@usepatch.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 5.3.1
|
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#Patch API
|
2
|
+
#Patch API V2
|
3
3
|
|
4
4
|
#The core API used to integrate with Patch's service
|
5
5
|
|
6
|
-
The version of the OpenAPI document:
|
6
|
+
The version of the OpenAPI document: 2
|
7
7
|
Contact: engineering@usepatch.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 5.3.1
|
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#Patch API
|
2
|
+
#Patch API V2
|
3
3
|
|
4
4
|
#The core API used to integrate with Patch's service
|
5
5
|
|
6
|
-
The version of the OpenAPI document:
|
6
|
+
The version of the OpenAPI document: 2
|
7
7
|
Contact: engineering@usepatch.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 5.3.1
|
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#Patch API
|
2
|
+
#Patch API V2
|
3
3
|
|
4
4
|
#The core API used to integrate with Patch's service
|
5
5
|
|
6
|
-
The version of the OpenAPI document:
|
6
|
+
The version of the OpenAPI document: 2
|
7
7
|
Contact: engineering@usepatch.com
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
9
|
OpenAPI Generator version: 5.3.1
|