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
|
@@ -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
|
@@ -21,9 +21,6 @@ module Patch
|
|
21
21
|
# The timestamp at which the order was created
|
22
22
|
attr_accessor :created_at
|
23
23
|
|
24
|
-
# DEPRECATED, use `amount` and `unit` fields instead. The amount of carbon offsets in grams purchased through this order.
|
25
|
-
attr_accessor :mass_g
|
26
|
-
|
27
24
|
# A boolean indicating if this order is a production or demo mode order.
|
28
25
|
attr_accessor :production
|
29
26
|
|
@@ -45,26 +42,14 @@ module Patch
|
|
45
42
|
# The currency code for the `price` and `patch_fee`.
|
46
43
|
attr_accessor :currency
|
47
44
|
|
48
|
-
#
|
49
|
-
attr_accessor :allocation_state
|
50
|
-
|
51
|
-
# DEPRECATED, use the `price` and `currency` fields instead. The total price in cents USD of the carbon offsets purchased through this order.
|
52
|
-
attr_accessor :price_cents_usd
|
53
|
-
|
54
|
-
# DEPRECATED, use the `patch_fee` and `currency` fields instead. The Patch Fee in cents USD for this order.
|
55
|
-
attr_accessor :patch_fee_cents_usd
|
56
|
-
|
57
|
-
# DEPRECATED. An array containing the inventory allocations for this order.
|
58
|
-
attr_accessor :allocations
|
59
|
-
|
60
|
-
# The url of this order in the public registry.
|
45
|
+
# The URL of this order in the public registry. Use this URL to access the order's accompanying certificate.
|
61
46
|
attr_accessor :registry_url
|
62
47
|
|
63
48
|
# An optional JSON object containing metadata for this order.
|
64
49
|
attr_accessor :metadata
|
65
50
|
|
66
|
-
# An array containing the
|
67
|
-
attr_accessor :
|
51
|
+
# An array containing the line items allocated for this order. Line items are grouped by project, vintage year, and price.
|
52
|
+
attr_accessor :line_items
|
68
53
|
|
69
54
|
# An object containing the name & email of the party the inventory will be issued to.
|
70
55
|
attr_accessor :issued_to
|
@@ -96,7 +81,6 @@ module Patch
|
|
96
81
|
{
|
97
82
|
:'id' => :'id',
|
98
83
|
:'created_at' => :'created_at',
|
99
|
-
:'mass_g' => :'mass_g',
|
100
84
|
:'production' => :'production',
|
101
85
|
:'state' => :'state',
|
102
86
|
:'amount' => :'amount',
|
@@ -104,13 +88,9 @@ module Patch
|
|
104
88
|
:'price' => :'price',
|
105
89
|
:'patch_fee' => :'patch_fee',
|
106
90
|
:'currency' => :'currency',
|
107
|
-
:'allocation_state' => :'allocation_state',
|
108
|
-
:'price_cents_usd' => :'price_cents_usd',
|
109
|
-
:'patch_fee_cents_usd' => :'patch_fee_cents_usd',
|
110
|
-
:'allocations' => :'allocations',
|
111
91
|
:'registry_url' => :'registry_url',
|
112
92
|
:'metadata' => :'metadata',
|
113
|
-
:'
|
93
|
+
:'line_items' => :'line_items',
|
114
94
|
:'issued_to' => :'issued_to'
|
115
95
|
}
|
116
96
|
end
|
@@ -125,7 +105,6 @@ module Patch
|
|
125
105
|
{
|
126
106
|
:'id' => :'String',
|
127
107
|
:'created_at' => :'Time',
|
128
|
-
:'mass_g' => :'Integer',
|
129
108
|
:'production' => :'Boolean',
|
130
109
|
:'state' => :'String',
|
131
110
|
:'amount' => :'Integer',
|
@@ -133,13 +112,9 @@ module Patch
|
|
133
112
|
:'price' => :'Integer',
|
134
113
|
:'patch_fee' => :'Integer',
|
135
114
|
:'currency' => :'String',
|
136
|
-
:'allocation_state' => :'String',
|
137
|
-
:'price_cents_usd' => :'Integer',
|
138
|
-
:'patch_fee_cents_usd' => :'Integer',
|
139
|
-
:'allocations' => :'Array<Allocation>',
|
140
115
|
:'registry_url' => :'String',
|
141
116
|
:'metadata' => :'Object',
|
142
|
-
:'
|
117
|
+
:'line_items' => :'Array<OrderLineItem>',
|
143
118
|
:'issued_to' => :'OrderIssuedTo'
|
144
119
|
}
|
145
120
|
end
|
@@ -147,8 +122,6 @@ module Patch
|
|
147
122
|
# List of attributes with nullable: true
|
148
123
|
def self.openapi_nullable
|
149
124
|
Set.new([
|
150
|
-
:'price_cents_usd',
|
151
|
-
:'patch_fee_cents_usd',
|
152
125
|
])
|
153
126
|
end
|
154
127
|
|
@@ -187,10 +160,6 @@ module Patch
|
|
187
160
|
self.created_at = attributes[:'created_at']
|
188
161
|
end
|
189
162
|
|
190
|
-
if attributes.key?(:'mass_g')
|
191
|
-
self.mass_g = attributes[:'mass_g']
|
192
|
-
end
|
193
|
-
|
194
163
|
if attributes.key?(:'production')
|
195
164
|
self.production = attributes[:'production']
|
196
165
|
end
|
@@ -219,24 +188,6 @@ module Patch
|
|
219
188
|
self.currency = attributes[:'currency']
|
220
189
|
end
|
221
190
|
|
222
|
-
if attributes.key?(:'allocation_state')
|
223
|
-
self.allocation_state = attributes[:'allocation_state']
|
224
|
-
end
|
225
|
-
|
226
|
-
if attributes.key?(:'price_cents_usd')
|
227
|
-
self.price_cents_usd = attributes[:'price_cents_usd']
|
228
|
-
end
|
229
|
-
|
230
|
-
if attributes.key?(:'patch_fee_cents_usd')
|
231
|
-
self.patch_fee_cents_usd = attributes[:'patch_fee_cents_usd']
|
232
|
-
end
|
233
|
-
|
234
|
-
if attributes.key?(:'allocations')
|
235
|
-
if (value = attributes[:'allocations']).is_a?(Array)
|
236
|
-
self.allocations = value
|
237
|
-
end
|
238
|
-
end
|
239
|
-
|
240
191
|
if attributes.key?(:'registry_url')
|
241
192
|
self.registry_url = attributes[:'registry_url']
|
242
193
|
end
|
@@ -245,9 +196,9 @@ module Patch
|
|
245
196
|
self.metadata = attributes[:'metadata']
|
246
197
|
end
|
247
198
|
|
248
|
-
if attributes.key?(:'
|
249
|
-
if (value = attributes[:'
|
250
|
-
self.
|
199
|
+
if attributes.key?(:'line_items')
|
200
|
+
if (value = attributes[:'line_items']).is_a?(Array)
|
201
|
+
self.line_items = value
|
251
202
|
end
|
252
203
|
end
|
253
204
|
|
@@ -267,18 +218,6 @@ module Patch
|
|
267
218
|
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
268
219
|
end
|
269
220
|
|
270
|
-
if @mass_g.nil?
|
271
|
-
invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
|
272
|
-
end
|
273
|
-
|
274
|
-
if @mass_g > 100000000000
|
275
|
-
invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 100000000000.')
|
276
|
-
end
|
277
|
-
|
278
|
-
if @mass_g < 0
|
279
|
-
invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 0.')
|
280
|
-
end
|
281
|
-
|
282
221
|
if @production.nil?
|
283
222
|
invalid_properties.push('invalid value for "production", production cannot be nil.')
|
284
223
|
end
|
@@ -291,8 +230,8 @@ module Patch
|
|
291
230
|
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
292
231
|
end
|
293
232
|
|
294
|
-
if @amount >
|
295
|
-
invalid_properties.push('invalid value for "amount", must be smaller than or equal to
|
233
|
+
if @amount > 100000000000000
|
234
|
+
invalid_properties.push('invalid value for "amount", must be smaller than or equal to 100000000000000.')
|
296
235
|
end
|
297
236
|
|
298
237
|
if @amount < 0
|
@@ -315,10 +254,6 @@ module Patch
|
|
315
254
|
invalid_properties.push('invalid value for "currency", currency cannot be nil.')
|
316
255
|
end
|
317
256
|
|
318
|
-
if @allocation_state.nil?
|
319
|
-
invalid_properties.push('invalid value for "allocation_state", allocation_state cannot be nil.')
|
320
|
-
end
|
321
|
-
|
322
257
|
if @metadata.nil?
|
323
258
|
invalid_properties.push('invalid value for "metadata", metadata cannot be nil.')
|
324
259
|
end
|
@@ -330,45 +265,21 @@ module Patch
|
|
330
265
|
# @return true if the model is valid
|
331
266
|
def valid?
|
332
267
|
return false if @id.nil?
|
333
|
-
return false if @mass_g.nil?
|
334
|
-
return false if @mass_g > 100000000000
|
335
|
-
return false if @mass_g < 0
|
336
268
|
return false if @production.nil?
|
337
269
|
return false if @state.nil?
|
338
270
|
state_validator = EnumAttributeValidator.new('String', ["draft", "reserved", "placed", "processing", "complete", "cancelled"])
|
339
271
|
return false unless state_validator.valid?(@state)
|
340
272
|
return false if @amount.nil?
|
341
|
-
return false if @amount >
|
273
|
+
return false if @amount > 100000000000000
|
342
274
|
return false if @amount < 0
|
343
275
|
return false if @unit.nil?
|
344
276
|
return false if @price.nil?
|
345
277
|
return false if @patch_fee.nil?
|
346
278
|
return false if @currency.nil?
|
347
|
-
return false if @allocation_state.nil?
|
348
|
-
allocation_state_validator = EnumAttributeValidator.new('String', ["pending", "allocated"])
|
349
|
-
return false unless allocation_state_validator.valid?(@allocation_state)
|
350
279
|
return false if @metadata.nil?
|
351
280
|
true
|
352
281
|
end
|
353
282
|
|
354
|
-
# Custom attribute writer method with validation
|
355
|
-
# @param [Object] mass_g Value to be assigned
|
356
|
-
def mass_g=(mass_g)
|
357
|
-
if mass_g.nil?
|
358
|
-
fail ArgumentError, 'mass_g cannot be nil'
|
359
|
-
end
|
360
|
-
|
361
|
-
if mass_g > 100000000000
|
362
|
-
fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 100000000000.'
|
363
|
-
end
|
364
|
-
|
365
|
-
if mass_g < 0
|
366
|
-
fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 0.'
|
367
|
-
end
|
368
|
-
|
369
|
-
@mass_g = mass_g
|
370
|
-
end
|
371
|
-
|
372
283
|
# Custom attribute writer method checking allowed values (enum).
|
373
284
|
# @param [Object] state Object to be assigned
|
374
285
|
def state=(state)
|
@@ -386,8 +297,8 @@ module Patch
|
|
386
297
|
fail ArgumentError, 'amount cannot be nil'
|
387
298
|
end
|
388
299
|
|
389
|
-
if amount >
|
390
|
-
fail ArgumentError, 'invalid value for "amount", must be smaller than or equal to
|
300
|
+
if amount > 100000000000000
|
301
|
+
fail ArgumentError, 'invalid value for "amount", must be smaller than or equal to 100000000000000.'
|
391
302
|
end
|
392
303
|
|
393
304
|
if amount < 0
|
@@ -397,16 +308,6 @@ module Patch
|
|
397
308
|
@amount = amount
|
398
309
|
end
|
399
310
|
|
400
|
-
# Custom attribute writer method checking allowed values (enum).
|
401
|
-
# @param [Object] allocation_state Object to be assigned
|
402
|
-
def allocation_state=(allocation_state)
|
403
|
-
validator = EnumAttributeValidator.new('String', ["pending", "allocated"])
|
404
|
-
unless validator.valid?(allocation_state)
|
405
|
-
fail ArgumentError, "invalid value for \"allocation_state\", must be one of #{validator.allowable_values}."
|
406
|
-
end
|
407
|
-
@allocation_state = allocation_state
|
408
|
-
end
|
409
|
-
|
410
311
|
# Checks equality by comparing each attribute.
|
411
312
|
# @param [Object] Object to be compared
|
412
313
|
def ==(o)
|
@@ -414,7 +315,6 @@ module Patch
|
|
414
315
|
self.class == o.class &&
|
415
316
|
id == o.id &&
|
416
317
|
created_at == o.created_at &&
|
417
|
-
mass_g == o.mass_g &&
|
418
318
|
production == o.production &&
|
419
319
|
state == o.state &&
|
420
320
|
amount == o.amount &&
|
@@ -422,13 +322,9 @@ module Patch
|
|
422
322
|
price == o.price &&
|
423
323
|
patch_fee == o.patch_fee &&
|
424
324
|
currency == o.currency &&
|
425
|
-
allocation_state == o.allocation_state &&
|
426
|
-
price_cents_usd == o.price_cents_usd &&
|
427
|
-
patch_fee_cents_usd == o.patch_fee_cents_usd &&
|
428
|
-
allocations == o.allocations &&
|
429
325
|
registry_url == o.registry_url &&
|
430
326
|
metadata == o.metadata &&
|
431
|
-
|
327
|
+
line_items == o.line_items &&
|
432
328
|
issued_to == o.issued_to
|
433
329
|
end
|
434
330
|
|
@@ -441,7 +337,7 @@ module Patch
|
|
441
337
|
# Calculates hash code according to all attributes.
|
442
338
|
# @return [Integer] Hash code
|
443
339
|
def hash
|
444
|
-
[id, created_at,
|
340
|
+
[id, created_at, production, state, amount, unit, price, patch_fee, currency, registry_url, metadata, line_items, issued_to].hash
|
445
341
|
end
|
446
342
|
|
447
343
|
# 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
|
@@ -14,13 +14,22 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module Patch
|
17
|
-
class
|
17
|
+
class OrderLineItem
|
18
|
+
# The identifier for this order line item
|
19
|
+
attr_accessor :id
|
20
|
+
|
18
21
|
# An object containing information about the project associated with the inventory allocated.
|
19
22
|
attr_accessor :project
|
20
23
|
|
21
24
|
# The year in which the climate impacts of the project occurred, or will occur.
|
22
25
|
attr_accessor :vintage_year
|
23
26
|
|
27
|
+
# The starting year in which the climate impacts of the project occurred, or will occur.
|
28
|
+
attr_accessor :vintage_start_year
|
29
|
+
|
30
|
+
# The ending year in which the climate impacts of the project occurred, or will occur.
|
31
|
+
attr_accessor :vintage_end_year
|
32
|
+
|
24
33
|
# The amount ordered for the given project and vintage year.
|
25
34
|
attr_accessor :amount
|
26
35
|
|
@@ -36,8 +45,11 @@ module Patch
|
|
36
45
|
# Attribute mapping from ruby-style variable name to JSON key.
|
37
46
|
def self.attribute_map
|
38
47
|
{
|
48
|
+
:'id' => :'id',
|
39
49
|
:'project' => :'project',
|
40
50
|
:'vintage_year' => :'vintage_year',
|
51
|
+
:'vintage_start_year' => :'vintage_start_year',
|
52
|
+
:'vintage_end_year' => :'vintage_end_year',
|
41
53
|
:'amount' => :'amount',
|
42
54
|
:'unit' => :'unit',
|
43
55
|
:'price' => :'price',
|
@@ -53,8 +65,11 @@ module Patch
|
|
53
65
|
# Attribute type mapping.
|
54
66
|
def self.openapi_types
|
55
67
|
{
|
56
|
-
:'
|
68
|
+
:'id' => :'String',
|
69
|
+
:'project' => :'OrderLineItemProject',
|
57
70
|
:'vintage_year' => :'Integer',
|
71
|
+
:'vintage_start_year' => :'Integer',
|
72
|
+
:'vintage_end_year' => :'Integer',
|
58
73
|
:'amount' => :'Integer',
|
59
74
|
:'unit' => :'String',
|
60
75
|
:'price' => :'Integer',
|
@@ -73,8 +88,8 @@ module Patch
|
|
73
88
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
74
89
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
75
90
|
def self.method_missing(message, *args, &block)
|
76
|
-
if Object.const_defined?('Patch::
|
77
|
-
Patch::
|
91
|
+
if Object.const_defined?('Patch::OrderLineItemsApi::OPERATIONS') && Patch::OrderLineItemsApi::OPERATIONS.include?(message)
|
92
|
+
Patch::OrderLineItemsApi.new.send(message, *args)
|
78
93
|
else
|
79
94
|
super
|
80
95
|
end
|
@@ -84,17 +99,21 @@ module Patch
|
|
84
99
|
# @param [Hash] attributes Model attributes in the form of hash
|
85
100
|
def initialize(attributes = {})
|
86
101
|
if (!attributes.is_a?(Hash))
|
87
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::
|
102
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::OrderLineItem` initialize method"
|
88
103
|
end
|
89
104
|
|
90
105
|
# check to see if the attribute exists and convert string to symbol for hash key
|
91
106
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
92
107
|
if (!self.class.attribute_map.key?(k.to_sym))
|
93
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::
|
108
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::OrderLineItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
94
109
|
end
|
95
110
|
h[k.to_sym] = v
|
96
111
|
}
|
97
112
|
|
113
|
+
if attributes.key?(:'id')
|
114
|
+
self.id = attributes[:'id']
|
115
|
+
end
|
116
|
+
|
98
117
|
if attributes.key?(:'project')
|
99
118
|
if (value = attributes[:'project']).is_a?(Hash)
|
100
119
|
self.project = value
|
@@ -106,6 +125,14 @@ module Patch
|
|
106
125
|
self.vintage_year = attributes[:'vintage_year']
|
107
126
|
end
|
108
127
|
|
128
|
+
if attributes.key?(:'vintage_start_year')
|
129
|
+
self.vintage_start_year = attributes[:'vintage_start_year']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'vintage_end_year')
|
133
|
+
self.vintage_end_year = attributes[:'vintage_end_year']
|
134
|
+
end
|
135
|
+
|
109
136
|
if attributes.key?(:'amount')
|
110
137
|
self.amount = attributes[:'amount']
|
111
138
|
end
|
@@ -135,6 +162,14 @@ module Patch
|
|
135
162
|
invalid_properties.push('invalid value for "vintage_year", vintage_year cannot be nil.')
|
136
163
|
end
|
137
164
|
|
165
|
+
if @vintage_start_year.nil?
|
166
|
+
invalid_properties.push('invalid value for "vintage_start_year", vintage_start_year cannot be nil.')
|
167
|
+
end
|
168
|
+
|
169
|
+
if @vintage_end_year.nil?
|
170
|
+
invalid_properties.push('invalid value for "vintage_end_year", vintage_end_year cannot be nil.')
|
171
|
+
end
|
172
|
+
|
138
173
|
if @amount.nil?
|
139
174
|
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
140
175
|
end
|
@@ -159,6 +194,8 @@ module Patch
|
|
159
194
|
def valid?
|
160
195
|
return false if @project.nil?
|
161
196
|
return false if @vintage_year.nil?
|
197
|
+
return false if @vintage_start_year.nil?
|
198
|
+
return false if @vintage_end_year.nil?
|
162
199
|
return false if @amount.nil?
|
163
200
|
return false if @unit.nil?
|
164
201
|
return false if @price.nil?
|
@@ -171,8 +208,11 @@ module Patch
|
|
171
208
|
def ==(o)
|
172
209
|
return true if self.equal?(o)
|
173
210
|
self.class == o.class &&
|
211
|
+
id == o.id &&
|
174
212
|
project == o.project &&
|
175
213
|
vintage_year == o.vintage_year &&
|
214
|
+
vintage_start_year == o.vintage_start_year &&
|
215
|
+
vintage_end_year == o.vintage_end_year &&
|
176
216
|
amount == o.amount &&
|
177
217
|
unit == o.unit &&
|
178
218
|
price == o.price &&
|
@@ -188,7 +228,7 @@ module Patch
|
|
188
228
|
# Calculates hash code according to all attributes.
|
189
229
|
# @return [Integer] Hash code
|
190
230
|
def hash
|
191
|
-
[project, vintage_year, amount, unit, price, currency].hash
|
231
|
+
[id, project, vintage_year, vintage_start_year, vintage_end_year, amount, unit, price, currency].hash
|
192
232
|
end
|
193
233
|
|
194
234
|
# 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
|
@@ -14,7 +14,7 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module Patch
|
17
|
-
class
|
17
|
+
class OrderLineItemProject
|
18
18
|
# The unique uid for a project. UIDs will be prepended by pro_prod or pro_test depending on the mode it was created in.
|
19
19
|
attr_accessor :id
|
20
20
|
|
@@ -53,8 +53,8 @@ module Patch
|
|
53
53
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
54
54
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
55
55
|
def self.method_missing(message, *args, &block)
|
56
|
-
if Object.const_defined?('Patch::
|
57
|
-
Patch::
|
56
|
+
if Object.const_defined?('Patch::OrderLineItemProjectsApi::OPERATIONS') && Patch::OrderLineItemProjectsApi::OPERATIONS.include?(message)
|
57
|
+
Patch::OrderLineItemProjectsApi.new.send(message, *args)
|
58
58
|
else
|
59
59
|
super
|
60
60
|
end
|
@@ -64,13 +64,13 @@ module Patch
|
|
64
64
|
# @param [Hash] attributes Model attributes in the form of hash
|
65
65
|
def initialize(attributes = {})
|
66
66
|
if (!attributes.is_a?(Hash))
|
67
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::
|
67
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::OrderLineItemProject` initialize method"
|
68
68
|
end
|
69
69
|
|
70
70
|
# check to see if the attribute exists and convert string to symbol for hash key
|
71
71
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
72
72
|
if (!self.class.attribute_map.key?(k.to_sym))
|
73
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::
|
73
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::OrderLineItemProject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
74
74
|
end
|
75
75
|
h[k.to_sym] = v
|
76
76
|
}
|