patch_ruby 1.24.2 → 2.1.1
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/CHANGELOG.md +19 -0
- data/Gemfile.lock +9 -10
- 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 +3 -4
- 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 +7 -7
- data/lib/patch_ruby/models/create_order_line_item_request.rb +443 -0
- data/lib/patch_ruby/models/create_order_request.rb +79 -70
- data/lib/patch_ruby/models/create_rail_shipping_estimate_request.rb +2 -2
- data/lib/patch_ruby/models/create_road_shipping_estimate_request.rb +13 -3
- 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/disclaimer.rb +282 -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 +33 -3
- data/lib/patch_ruby/models/meta_index_object.rb +2 -2
- data/lib/patch_ruby/models/order.rb +17 -121
- data/lib/patch_ruby/models/order_issued_to.rb +2 -2
- data/lib/patch_ruby/models/{order_inventory.rb → order_line_item.rb} +49 -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 +72 -56
- 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 +434 -0
- data/lib/patch_ruby/version.rb +3 -3
- data/lib/patch_ruby.rb +11 -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/estimates_spec.rb +1 -1
- data/spec/integration/orders_spec.rb +121 -44
- data/spec/integration/projects_spec.rb +19 -7
- 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 +35 -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
|
@@ -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
|
@@ -27,6 +23,10 @@ module Patch
|
|
27
23
|
|
28
24
|
attr_accessor :vintage_year
|
29
25
|
|
26
|
+
attr_accessor :vintage_start_year
|
27
|
+
|
28
|
+
attr_accessor :vintage_end_year
|
29
|
+
|
30
30
|
attr_accessor :total_price
|
31
31
|
|
32
32
|
attr_accessor :currency
|
@@ -62,12 +62,12 @@ module Patch
|
|
62
62
|
# Attribute mapping from ruby-style variable name to JSON key.
|
63
63
|
def self.attribute_map
|
64
64
|
{
|
65
|
-
:'mass_g' => :'mass_g',
|
66
|
-
:'total_price_cents_usd' => :'total_price_cents_usd',
|
67
65
|
:'project_id' => :'project_id',
|
68
66
|
:'metadata' => :'metadata',
|
69
67
|
:'state' => :'state',
|
70
68
|
:'vintage_year' => :'vintage_year',
|
69
|
+
:'vintage_start_year' => :'vintage_start_year',
|
70
|
+
:'vintage_end_year' => :'vintage_end_year',
|
71
71
|
:'total_price' => :'total_price',
|
72
72
|
:'currency' => :'currency',
|
73
73
|
:'amount' => :'amount',
|
@@ -84,12 +84,12 @@ module Patch
|
|
84
84
|
# Attribute type mapping.
|
85
85
|
def self.openapi_types
|
86
86
|
{
|
87
|
-
:'mass_g' => :'Integer',
|
88
|
-
:'total_price_cents_usd' => :'Integer',
|
89
87
|
:'project_id' => :'String',
|
90
88
|
:'metadata' => :'Object',
|
91
89
|
:'state' => :'String',
|
92
90
|
:'vintage_year' => :'Integer',
|
91
|
+
:'vintage_start_year' => :'Integer',
|
92
|
+
:'vintage_end_year' => :'Integer',
|
93
93
|
:'total_price' => :'Integer',
|
94
94
|
:'currency' => :'String',
|
95
95
|
:'amount' => :'Integer',
|
@@ -101,12 +101,12 @@ module Patch
|
|
101
101
|
# List of attributes with nullable: true
|
102
102
|
def self.openapi_nullable
|
103
103
|
Set.new([
|
104
|
-
:'mass_g',
|
105
|
-
:'total_price_cents_usd',
|
106
104
|
:'project_id',
|
107
105
|
:'metadata',
|
108
106
|
:'state',
|
109
107
|
:'vintage_year',
|
108
|
+
:'vintage_start_year',
|
109
|
+
:'vintage_end_year',
|
110
110
|
:'total_price',
|
111
111
|
:'currency',
|
112
112
|
:'amount',
|
@@ -141,14 +141,6 @@ module Patch
|
|
141
141
|
h[k.to_sym] = v
|
142
142
|
}
|
143
143
|
|
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
144
|
if attributes.key?(:'project_id')
|
153
145
|
self.project_id = attributes[:'project_id']
|
154
146
|
end
|
@@ -165,6 +157,14 @@ module Patch
|
|
165
157
|
self.vintage_year = attributes[:'vintage_year']
|
166
158
|
end
|
167
159
|
|
160
|
+
if attributes.key?(:'vintage_start_year')
|
161
|
+
self.vintage_start_year = attributes[:'vintage_start_year']
|
162
|
+
end
|
163
|
+
|
164
|
+
if attributes.key?(:'vintage_end_year')
|
165
|
+
self.vintage_end_year = attributes[:'vintage_end_year']
|
166
|
+
end
|
167
|
+
|
168
168
|
if attributes.key?(:'total_price')
|
169
169
|
self.total_price = attributes[:'total_price']
|
170
170
|
end
|
@@ -190,32 +190,36 @@ module Patch
|
|
190
190
|
# @return Array for valid properties with the reasons
|
191
191
|
def list_invalid_properties
|
192
192
|
invalid_properties = Array.new
|
193
|
-
if !@
|
194
|
-
invalid_properties.push('invalid value for "
|
193
|
+
if !@vintage_year.nil? && @vintage_year > 2100
|
194
|
+
invalid_properties.push('invalid value for "vintage_year", must be smaller than or equal to 2100.')
|
195
195
|
end
|
196
196
|
|
197
|
-
if !@
|
198
|
-
invalid_properties.push('invalid value for "
|
197
|
+
if !@vintage_year.nil? && @vintage_year < 1900
|
198
|
+
invalid_properties.push('invalid value for "vintage_year", must be greater than or equal to 1900.')
|
199
199
|
end
|
200
200
|
|
201
|
-
if !@
|
202
|
-
invalid_properties.push('invalid value for "
|
201
|
+
if !@vintage_start_year.nil? && @vintage_start_year > 2100
|
202
|
+
invalid_properties.push('invalid value for "vintage_start_year", must be smaller than or equal to 2100.')
|
203
203
|
end
|
204
204
|
|
205
|
-
if !@
|
206
|
-
invalid_properties.push('invalid value for "
|
205
|
+
if !@vintage_start_year.nil? && @vintage_start_year < 1900
|
206
|
+
invalid_properties.push('invalid value for "vintage_start_year", must be greater than or equal to 1900.')
|
207
207
|
end
|
208
208
|
|
209
|
-
if !@
|
210
|
-
invalid_properties.push('invalid value for "
|
209
|
+
if !@vintage_end_year.nil? && @vintage_end_year > 2100
|
210
|
+
invalid_properties.push('invalid value for "vintage_end_year", must be smaller than or equal to 2100.')
|
211
|
+
end
|
212
|
+
|
213
|
+
if !@vintage_end_year.nil? && @vintage_end_year < 1900
|
214
|
+
invalid_properties.push('invalid value for "vintage_end_year", must be greater than or equal to 1900.')
|
211
215
|
end
|
212
216
|
|
213
|
-
if !@total_price.nil? && @total_price <
|
214
|
-
invalid_properties.push('invalid value for "total_price", must be greater than or equal to
|
217
|
+
if !@total_price.nil? && @total_price < 2
|
218
|
+
invalid_properties.push('invalid value for "total_price", must be greater than or equal to 2.')
|
215
219
|
end
|
216
220
|
|
217
|
-
if !@amount.nil? && @amount >
|
218
|
-
invalid_properties.push('invalid value for "amount", must be smaller than or equal to
|
221
|
+
if !@amount.nil? && @amount > 100000000000000
|
222
|
+
invalid_properties.push('invalid value for "amount", must be smaller than or equal to 100000000000000.')
|
219
223
|
end
|
220
224
|
|
221
225
|
if !@amount.nil? && @amount < 0
|
@@ -228,45 +232,22 @@ module Patch
|
|
228
232
|
# Check to see if the all the properties in the model are valid
|
229
233
|
# @return true if the model is valid
|
230
234
|
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
235
|
state_validator = EnumAttributeValidator.new('String', ["draft", "reserved", "placed"])
|
235
236
|
return false unless state_validator.valid?(@state)
|
236
237
|
return false if !@vintage_year.nil? && @vintage_year > 2100
|
237
238
|
return false if !@vintage_year.nil? && @vintage_year < 1900
|
238
|
-
return false if !@
|
239
|
-
return false if !@
|
239
|
+
return false if !@vintage_start_year.nil? && @vintage_start_year > 2100
|
240
|
+
return false if !@vintage_start_year.nil? && @vintage_start_year < 1900
|
241
|
+
return false if !@vintage_end_year.nil? && @vintage_end_year > 2100
|
242
|
+
return false if !@vintage_end_year.nil? && @vintage_end_year < 1900
|
243
|
+
return false if !@total_price.nil? && @total_price < 2
|
244
|
+
return false if !@amount.nil? && @amount > 100000000000000
|
240
245
|
return false if !@amount.nil? && @amount < 0
|
241
246
|
unit_validator = EnumAttributeValidator.new('String', ["g", "Wh"])
|
242
247
|
return false unless unit_validator.valid?(@unit)
|
243
248
|
true
|
244
249
|
end
|
245
250
|
|
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
251
|
# Custom attribute writer method checking allowed values (enum).
|
271
252
|
# @param [Object] state Object to be assigned
|
272
253
|
def state=(state)
|
@@ -291,11 +272,39 @@ module Patch
|
|
291
272
|
@vintage_year = vintage_year
|
292
273
|
end
|
293
274
|
|
275
|
+
# Custom attribute writer method with validation
|
276
|
+
# @param [Object] vintage_start_year Value to be assigned
|
277
|
+
def vintage_start_year=(vintage_start_year)
|
278
|
+
if !vintage_start_year.nil? && vintage_start_year > 2100
|
279
|
+
fail ArgumentError, 'invalid value for "vintage_start_year", must be smaller than or equal to 2100.'
|
280
|
+
end
|
281
|
+
|
282
|
+
if !vintage_start_year.nil? && vintage_start_year < 1900
|
283
|
+
fail ArgumentError, 'invalid value for "vintage_start_year", must be greater than or equal to 1900.'
|
284
|
+
end
|
285
|
+
|
286
|
+
@vintage_start_year = vintage_start_year
|
287
|
+
end
|
288
|
+
|
289
|
+
# Custom attribute writer method with validation
|
290
|
+
# @param [Object] vintage_end_year Value to be assigned
|
291
|
+
def vintage_end_year=(vintage_end_year)
|
292
|
+
if !vintage_end_year.nil? && vintage_end_year > 2100
|
293
|
+
fail ArgumentError, 'invalid value for "vintage_end_year", must be smaller than or equal to 2100.'
|
294
|
+
end
|
295
|
+
|
296
|
+
if !vintage_end_year.nil? && vintage_end_year < 1900
|
297
|
+
fail ArgumentError, 'invalid value for "vintage_end_year", must be greater than or equal to 1900.'
|
298
|
+
end
|
299
|
+
|
300
|
+
@vintage_end_year = vintage_end_year
|
301
|
+
end
|
302
|
+
|
294
303
|
# Custom attribute writer method with validation
|
295
304
|
# @param [Object] total_price Value to be assigned
|
296
305
|
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
|
306
|
+
if !total_price.nil? && total_price < 2
|
307
|
+
fail ArgumentError, 'invalid value for "total_price", must be greater than or equal to 2.'
|
299
308
|
end
|
300
309
|
|
301
310
|
@total_price = total_price
|
@@ -304,8 +313,8 @@ module Patch
|
|
304
313
|
# Custom attribute writer method with validation
|
305
314
|
# @param [Object] amount Value to be assigned
|
306
315
|
def amount=(amount)
|
307
|
-
if !amount.nil? && amount >
|
308
|
-
fail ArgumentError, 'invalid value for "amount", must be smaller than or equal to
|
316
|
+
if !amount.nil? && amount > 100000000000000
|
317
|
+
fail ArgumentError, 'invalid value for "amount", must be smaller than or equal to 100000000000000.'
|
309
318
|
end
|
310
319
|
|
311
320
|
if !amount.nil? && amount < 0
|
@@ -330,12 +339,12 @@ module Patch
|
|
330
339
|
def ==(o)
|
331
340
|
return true if self.equal?(o)
|
332
341
|
self.class == o.class &&
|
333
|
-
mass_g == o.mass_g &&
|
334
|
-
total_price_cents_usd == o.total_price_cents_usd &&
|
335
342
|
project_id == o.project_id &&
|
336
343
|
metadata == o.metadata &&
|
337
344
|
state == o.state &&
|
338
345
|
vintage_year == o.vintage_year &&
|
346
|
+
vintage_start_year == o.vintage_start_year &&
|
347
|
+
vintage_end_year == o.vintage_end_year &&
|
339
348
|
total_price == o.total_price &&
|
340
349
|
currency == o.currency &&
|
341
350
|
amount == o.amount &&
|
@@ -352,7 +361,7 @@ module Patch
|
|
352
361
|
# Calculates hash code according to all attributes.
|
353
362
|
# @return [Integer] Hash code
|
354
363
|
def hash
|
355
|
-
[
|
364
|
+
[project_id, metadata, state, vintage_year, vintage_start_year, vintage_end_year, total_price, currency, amount, unit, issued_to].hash
|
356
365
|
end
|
357
366
|
|
358
367
|
# 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
|
@@ -41,6 +41,8 @@ module Patch
|
|
41
41
|
|
42
42
|
attr_accessor :truck_weight_t
|
43
43
|
|
44
|
+
attr_accessor :carrier_scac
|
45
|
+
|
44
46
|
attr_accessor :project_id
|
45
47
|
|
46
48
|
attr_accessor :create_order
|
@@ -83,6 +85,7 @@ module Patch
|
|
83
85
|
:'fuel_type' => :'fuel_type',
|
84
86
|
:'number_of_containers' => :'number_of_containers',
|
85
87
|
:'truck_weight_t' => :'truck_weight_t',
|
88
|
+
:'carrier_scac' => :'carrier_scac',
|
86
89
|
:'project_id' => :'project_id',
|
87
90
|
:'create_order' => :'create_order'
|
88
91
|
}
|
@@ -109,6 +112,7 @@ module Patch
|
|
109
112
|
:'fuel_type' => :'String',
|
110
113
|
:'number_of_containers' => :'Integer',
|
111
114
|
:'truck_weight_t' => :'Integer',
|
115
|
+
:'carrier_scac' => :'String',
|
112
116
|
:'project_id' => :'String',
|
113
117
|
:'create_order' => :'Boolean'
|
114
118
|
}
|
@@ -127,6 +131,7 @@ module Patch
|
|
127
131
|
:'fuel_type',
|
128
132
|
:'number_of_containers',
|
129
133
|
:'truck_weight_t',
|
134
|
+
:'carrier_scac',
|
130
135
|
:'project_id',
|
131
136
|
:'create_order'
|
132
137
|
])
|
@@ -217,6 +222,10 @@ module Patch
|
|
217
222
|
self.truck_weight_t = attributes[:'truck_weight_t']
|
218
223
|
end
|
219
224
|
|
225
|
+
if attributes.key?(:'carrier_scac')
|
226
|
+
self.carrier_scac = attributes[:'carrier_scac']
|
227
|
+
end
|
228
|
+
|
220
229
|
if attributes.key?(:'project_id')
|
221
230
|
self.project_id = attributes[:'project_id']
|
222
231
|
end
|
@@ -370,6 +379,7 @@ module Patch
|
|
370
379
|
fuel_type == o.fuel_type &&
|
371
380
|
number_of_containers == o.number_of_containers &&
|
372
381
|
truck_weight_t == o.truck_weight_t &&
|
382
|
+
carrier_scac == o.carrier_scac &&
|
373
383
|
project_id == o.project_id &&
|
374
384
|
create_order == o.create_order
|
375
385
|
end
|
@@ -383,7 +393,7 @@ module Patch
|
|
383
393
|
# Calculates hash code according to all attributes.
|
384
394
|
# @return [Integer] Hash code
|
385
395
|
def hash
|
386
|
-
[destination_country_code, destination_locode, destination_postal_code, origin_country_code, origin_locode, origin_postal_code, cargo_type, container_size_code, emissions_scope, freight_mass_g, fuel_type, number_of_containers, truck_weight_t, project_id, create_order].hash
|
396
|
+
[destination_country_code, destination_locode, destination_postal_code, origin_country_code, origin_locode, origin_postal_code, cargo_type, container_size_code, emissions_scope, freight_mass_g, fuel_type, number_of_containers, truck_weight_t, carrier_scac, project_id, create_order].hash
|
387
397
|
end
|
388
398
|
|
389
399
|
# 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
|
@@ -0,0 +1,257 @@
|
|
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 DeleteOrderLineItemResponse
|
18
|
+
attr_accessor :success
|
19
|
+
|
20
|
+
attr_accessor :error
|
21
|
+
|
22
|
+
attr_accessor :data
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'success' => :'success',
|
28
|
+
:'error' => :'error',
|
29
|
+
:'data' => :'data'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'success' => :'Boolean',
|
42
|
+
:'error' => :'Object',
|
43
|
+
:'data' => :'String'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# List of attributes with nullable: true
|
48
|
+
def self.openapi_nullable
|
49
|
+
Set.new([
|
50
|
+
:'error',
|
51
|
+
])
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
# Allows models with corresponding API classes to delegate API operations to those API classes
|
56
|
+
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
57
|
+
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
58
|
+
def self.method_missing(message, *args, &block)
|
59
|
+
if Object.const_defined?('Patch::DeleteOrderLineItemResponsesApi::OPERATIONS') && Patch::DeleteOrderLineItemResponsesApi::OPERATIONS.include?(message)
|
60
|
+
Patch::DeleteOrderLineItemResponsesApi.new.send(message, *args)
|
61
|
+
else
|
62
|
+
super
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes the object
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
+
def initialize(attributes = {})
|
69
|
+
if (!attributes.is_a?(Hash))
|
70
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::DeleteOrderLineItemResponse` initialize method"
|
71
|
+
end
|
72
|
+
|
73
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
74
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
75
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
76
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::DeleteOrderLineItemResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
77
|
+
end
|
78
|
+
h[k.to_sym] = v
|
79
|
+
}
|
80
|
+
|
81
|
+
if attributes.key?(:'success')
|
82
|
+
self.success = attributes[:'success']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.key?(:'error')
|
86
|
+
self.error = attributes[:'error']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.key?(:'data')
|
90
|
+
self.data = attributes[:'data']
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
95
|
+
# @return Array for valid properties with the reasons
|
96
|
+
def list_invalid_properties
|
97
|
+
invalid_properties = Array.new
|
98
|
+
if @success.nil?
|
99
|
+
invalid_properties.push('invalid value for "success", success cannot be nil.')
|
100
|
+
end
|
101
|
+
|
102
|
+
if @data.nil?
|
103
|
+
invalid_properties.push('invalid value for "data", data cannot be nil.')
|
104
|
+
end
|
105
|
+
|
106
|
+
invalid_properties
|
107
|
+
end
|
108
|
+
|
109
|
+
# Check to see if the all the properties in the model are valid
|
110
|
+
# @return true if the model is valid
|
111
|
+
def valid?
|
112
|
+
return false if @success.nil?
|
113
|
+
return false if @data.nil?
|
114
|
+
true
|
115
|
+
end
|
116
|
+
|
117
|
+
# Checks equality by comparing each attribute.
|
118
|
+
# @param [Object] Object to be compared
|
119
|
+
def ==(o)
|
120
|
+
return true if self.equal?(o)
|
121
|
+
self.class == o.class &&
|
122
|
+
success == o.success &&
|
123
|
+
error == o.error &&
|
124
|
+
data == o.data
|
125
|
+
end
|
126
|
+
|
127
|
+
# @see the `==` method
|
128
|
+
# @param [Object] Object to be compared
|
129
|
+
def eql?(o)
|
130
|
+
self == o
|
131
|
+
end
|
132
|
+
|
133
|
+
# Calculates hash code according to all attributes.
|
134
|
+
# @return [Integer] Hash code
|
135
|
+
def hash
|
136
|
+
[success, error, data].hash
|
137
|
+
end
|
138
|
+
|
139
|
+
# Builds the object from hash
|
140
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
141
|
+
# @return [Object] Returns the model itself
|
142
|
+
def self.build_from_hash(attributes)
|
143
|
+
new.build_from_hash(attributes)
|
144
|
+
end
|
145
|
+
|
146
|
+
# Builds the object from hash
|
147
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
148
|
+
# @return [Object] Returns the model itself
|
149
|
+
def build_from_hash(attributes)
|
150
|
+
return nil unless attributes.is_a?(Hash)
|
151
|
+
self.class.openapi_types.each_pair do |key, type|
|
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
|
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
|
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 :Time
|
175
|
+
Time.parse(value)
|
176
|
+
when :Date
|
177
|
+
Date.parse(value)
|
178
|
+
when :String
|
179
|
+
value.to_s
|
180
|
+
when :Integer
|
181
|
+
value.to_i
|
182
|
+
when :Float
|
183
|
+
value.to_f
|
184
|
+
when :Boolean
|
185
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
186
|
+
true
|
187
|
+
else
|
188
|
+
false
|
189
|
+
end
|
190
|
+
when :Object
|
191
|
+
# generic object (usually a Hash), return directly
|
192
|
+
value
|
193
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
194
|
+
inner_type = Regexp.last_match[:inner_type]
|
195
|
+
value.map { |v| _deserialize(inner_type, v) }
|
196
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
197
|
+
k_type = Regexp.last_match[:k_type]
|
198
|
+
v_type = Regexp.last_match[:v_type]
|
199
|
+
{}.tap do |hash|
|
200
|
+
value.each do |k, v|
|
201
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
else # model
|
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)
|
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
|
226
|
+
hash = {}
|
227
|
+
self.class.attribute_map.each_pair do |attr, param|
|
228
|
+
value = self.send(attr)
|
229
|
+
if value.nil?
|
230
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
231
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
232
|
+
end
|
233
|
+
|
234
|
+
hash[param] = _to_hash(value)
|
235
|
+
end
|
236
|
+
hash
|
237
|
+
end
|
238
|
+
|
239
|
+
# Outputs non-array value in the form of hash
|
240
|
+
# For object, use to_hash. Otherwise, just return the value
|
241
|
+
# @param [Object] value Any valid value
|
242
|
+
# @return [Hash] Returns the value in the form of hash
|
243
|
+
def _to_hash(value)
|
244
|
+
if value.is_a?(Array)
|
245
|
+
value.compact.map { |v| _to_hash(v) }
|
246
|
+
elsif value.is_a?(Hash)
|
247
|
+
{}.tap do |hash|
|
248
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
249
|
+
end
|
250
|
+
elsif value.respond_to? :to_hash
|
251
|
+
value.to_hash
|
252
|
+
else
|
253
|
+
value
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|