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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/patch_ruby/api/estimates_api.rb +72 -2
  4. data/lib/patch_ruby/api/order_line_items_api.rb +269 -0
  5. data/lib/patch_ruby/api/orders_api.rb +99 -4
  6. data/lib/patch_ruby/api/projects_api.rb +12 -2
  7. data/lib/patch_ruby/api/technology_types_api.rb +7 -2
  8. data/lib/patch_ruby/api_client.rb +3 -3
  9. data/lib/patch_ruby/api_error.rb +2 -2
  10. data/lib/patch_ruby/configuration.rb +2 -2
  11. data/lib/patch_ruby/models/create_air_shipping_estimate_request.rb +2 -2
  12. data/lib/patch_ruby/models/create_bitcoin_estimate_request.rb +2 -2
  13. data/lib/patch_ruby/models/create_ecommerce_estimate_request.rb +2 -2
  14. data/lib/patch_ruby/models/create_ethereum_estimate_request.rb +2 -2
  15. data/lib/patch_ruby/models/create_flight_estimate_request.rb +2 -2
  16. data/lib/patch_ruby/models/create_hotel_estimate_request.rb +2 -2
  17. data/lib/patch_ruby/models/create_mass_estimate_request.rb +2 -2
  18. data/lib/patch_ruby/models/create_order_line_item_request.rb +375 -0
  19. data/lib/patch_ruby/models/create_order_request.rb +8 -67
  20. data/lib/patch_ruby/models/create_rail_shipping_estimate_request.rb +2 -2
  21. data/lib/patch_ruby/models/create_road_shipping_estimate_request.rb +2 -2
  22. data/lib/patch_ruby/models/create_sea_shipping_estimate_request.rb +2 -2
  23. data/lib/patch_ruby/models/create_shipping_estimate_request.rb +2 -2
  24. data/lib/patch_ruby/models/create_success_response.rb +2 -2
  25. data/lib/patch_ruby/models/create_vehicle_estimate_request.rb +2 -2
  26. data/lib/patch_ruby/models/delete_order_line_item_response.rb +257 -0
  27. data/lib/patch_ruby/models/delete_order_response.rb +257 -0
  28. data/lib/patch_ruby/models/error_response.rb +2 -2
  29. data/lib/patch_ruby/models/estimate.rb +2 -2
  30. data/lib/patch_ruby/models/estimate_list_response.rb +2 -2
  31. data/lib/patch_ruby/models/estimate_response.rb +2 -2
  32. data/lib/patch_ruby/models/highlight.rb +2 -2
  33. data/lib/patch_ruby/models/inventory.rb +2 -2
  34. data/lib/patch_ruby/models/meta_index_object.rb +2 -2
  35. data/lib/patch_ruby/models/order.rb +11 -115
  36. data/lib/patch_ruby/models/order_issued_to.rb +2 -2
  37. data/lib/patch_ruby/models/{order_inventory.rb → order_line_item.rb} +19 -9
  38. data/lib/patch_ruby/models/{order_inventory_project.rb → order_line_item_project.rb} +7 -7
  39. data/lib/patch_ruby/models/{allocation.rb → order_line_item_response.rb} +33 -40
  40. data/lib/patch_ruby/models/order_list_response.rb +2 -2
  41. data/lib/patch_ruby/models/order_response.rb +2 -2
  42. data/lib/patch_ruby/models/parent_technology_type.rb +2 -2
  43. data/lib/patch_ruby/models/photo.rb +2 -2
  44. data/lib/patch_ruby/models/place_order_request.rb +2 -2
  45. data/lib/patch_ruby/models/project.rb +13 -53
  46. data/lib/patch_ruby/models/project_list_response.rb +2 -2
  47. data/lib/patch_ruby/models/project_response.rb +2 -2
  48. data/lib/patch_ruby/models/sdg.rb +2 -2
  49. data/lib/patch_ruby/models/standard.rb +2 -2
  50. data/lib/patch_ruby/models/technology_type.rb +2 -2
  51. data/lib/patch_ruby/models/technology_type_list_response.rb +2 -2
  52. data/lib/patch_ruby/models/update_order_line_item_request.rb +366 -0
  53. data/lib/patch_ruby/version.rb +3 -3
  54. data/lib/patch_ruby.rb +10 -5
  55. data/patch_ruby.gemspec +2 -2
  56. data/spec/api/order_line_items_api_spec.rb +78 -0
  57. data/spec/api_client_spec.rb +2 -2
  58. data/spec/configuration_spec.rb +2 -2
  59. data/spec/factories/create_order_requests.rb +4 -2
  60. data/spec/factories/orders.rb +5 -4
  61. data/spec/factories/projects.rb +1 -4
  62. data/spec/integration/orders_spec.rb +85 -44
  63. data/spec/integration/projects_spec.rb +2 -4
  64. data/spec/models/create_order_request_spec.rb +10 -3
  65. data/spec/models/order_spec.rb +8 -23
  66. data/spec/models/project_spec.rb +1 -4
  67. data/spec/spec_helper.rb +2 -2
  68. metadata +34 -31
  69. data/spec/factories/allocations.rb +0 -7
  70. data/spec/models/allocation_spec.rb +0 -59
@@ -1,9 +1,9 @@
1
1
  =begin
2
- #Patch API V1
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: v1
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
- # DEPRECATED. Indicates if the order has been fully allocated to projects.
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
45
  # The url of this order in the public registry.
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 inventory allocated for this order. Inventory is grouped by project, vintage year, and price.
67
- attr_accessor :inventory
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
- :'inventory' => :'inventory',
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
- :'inventory' => :'Array<OrderInventory>',
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?(:'inventory')
249
- if (value = attributes[:'inventory']).is_a?(Array)
250
- self.inventory = value
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
@@ -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,9 +265,6 @@ 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"])
@@ -344,31 +276,10 @@ module Patch
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)
@@ -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
- inventory == o.inventory &&
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, mass_g, production, state, amount, unit, price, patch_fee, currency, allocation_state, price_cents_usd, patch_fee_cents_usd, allocations, registry_url, metadata, inventory, issued_to].hash
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 V1
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: v1
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 V1
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: v1
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,10 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Patch
17
- class OrderInventory
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
 
@@ -36,6 +39,7 @@ module Patch
36
39
  # Attribute mapping from ruby-style variable name to JSON key.
37
40
  def self.attribute_map
38
41
  {
42
+ :'id' => :'id',
39
43
  :'project' => :'project',
40
44
  :'vintage_year' => :'vintage_year',
41
45
  :'amount' => :'amount',
@@ -53,7 +57,8 @@ module Patch
53
57
  # Attribute type mapping.
54
58
  def self.openapi_types
55
59
  {
56
- :'project' => :'OrderInventoryProject',
60
+ :'id' => :'String',
61
+ :'project' => :'OrderLineItemProject',
57
62
  :'vintage_year' => :'Integer',
58
63
  :'amount' => :'Integer',
59
64
  :'unit' => :'String',
@@ -73,8 +78,8 @@ module Patch
73
78
  # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
74
79
  # Eg. Order.create_order delegates to OrdersApi.new.create_order
75
80
  def self.method_missing(message, *args, &block)
76
- if Object.const_defined?('Patch::OrderInventorysApi::OPERATIONS') && Patch::OrderInventorysApi::OPERATIONS.include?(message)
77
- Patch::OrderInventorysApi.new.send(message, *args)
81
+ if Object.const_defined?('Patch::OrderLineItemsApi::OPERATIONS') && Patch::OrderLineItemsApi::OPERATIONS.include?(message)
82
+ Patch::OrderLineItemsApi.new.send(message, *args)
78
83
  else
79
84
  super
80
85
  end
@@ -84,17 +89,21 @@ module Patch
84
89
  # @param [Hash] attributes Model attributes in the form of hash
85
90
  def initialize(attributes = {})
86
91
  if (!attributes.is_a?(Hash))
87
- fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::OrderInventory` initialize method"
92
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::OrderLineItem` initialize method"
88
93
  end
89
94
 
90
95
  # check to see if the attribute exists and convert string to symbol for hash key
91
96
  attributes = attributes.each_with_object({}) { |(k, v), h|
92
97
  if (!self.class.attribute_map.key?(k.to_sym))
93
- fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::OrderInventory`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
98
+ 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
99
  end
95
100
  h[k.to_sym] = v
96
101
  }
97
102
 
103
+ if attributes.key?(:'id')
104
+ self.id = attributes[:'id']
105
+ end
106
+
98
107
  if attributes.key?(:'project')
99
108
  if (value = attributes[:'project']).is_a?(Hash)
100
109
  self.project = value
@@ -171,6 +180,7 @@ module Patch
171
180
  def ==(o)
172
181
  return true if self.equal?(o)
173
182
  self.class == o.class &&
183
+ id == o.id &&
174
184
  project == o.project &&
175
185
  vintage_year == o.vintage_year &&
176
186
  amount == o.amount &&
@@ -188,7 +198,7 @@ module Patch
188
198
  # Calculates hash code according to all attributes.
189
199
  # @return [Integer] Hash code
190
200
  def hash
191
- [project, vintage_year, amount, unit, price, currency].hash
201
+ [id, project, vintage_year, amount, unit, price, currency].hash
192
202
  end
193
203
 
194
204
  # Builds the object from hash
@@ -1,9 +1,9 @@
1
1
  =begin
2
- #Patch API V1
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: v1
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 OrderInventoryProject
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::OrderInventoryProjectsApi::OPERATIONS') && Patch::OrderInventoryProjectsApi::OPERATIONS.include?(message)
57
- Patch::OrderInventoryProjectsApi.new.send(message, *args)
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::OrderInventoryProject` initialize method"
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::OrderInventoryProject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
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
  }
@@ -1,9 +1,9 @@
1
1
  =begin
2
- #Patch API V1
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: v1
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,22 +14,19 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Patch
17
- class Allocation
18
- # A unique uid for the record. UIDs will be prepended by all_prod or all_test depending on the mode it was created in.
19
- attr_accessor :id
17
+ class OrderLineItemResponse
18
+ attr_accessor :success
20
19
 
21
- # A boolean indicating if this project is a production or demo mode project.
22
- attr_accessor :production
20
+ attr_accessor :error
23
21
 
24
- # The amount (in grams) of allocated carbon offsets.
25
- attr_accessor :mass_g
22
+ attr_accessor :data
26
23
 
27
24
  # Attribute mapping from ruby-style variable name to JSON key.
28
25
  def self.attribute_map
29
26
  {
30
- :'id' => :'id',
31
- :'production' => :'production',
32
- :'mass_g' => :'mass_g'
27
+ :'success' => :'success',
28
+ :'error' => :'error',
29
+ :'data' => :'data'
33
30
  }
34
31
  end
35
32
 
@@ -41,15 +38,16 @@ module Patch
41
38
  # Attribute type mapping.
42
39
  def self.openapi_types
43
40
  {
44
- :'id' => :'String',
45
- :'production' => :'Boolean',
46
- :'mass_g' => :'Integer'
41
+ :'success' => :'Boolean',
42
+ :'error' => :'Object',
43
+ :'data' => :'OrderLineItem'
47
44
  }
48
45
  end
49
46
 
50
47
  # List of attributes with nullable: true
51
48
  def self.openapi_nullable
52
49
  Set.new([
50
+ :'error',
53
51
  ])
54
52
  end
55
53
 
@@ -58,8 +56,8 @@ module Patch
58
56
  # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
59
57
  # Eg. Order.create_order delegates to OrdersApi.new.create_order
60
58
  def self.method_missing(message, *args, &block)
61
- if Object.const_defined?('Patch::AllocationsApi::OPERATIONS') && Patch::AllocationsApi::OPERATIONS.include?(message)
62
- Patch::AllocationsApi.new.send(message, *args)
59
+ if Object.const_defined?('Patch::OrderLineItemResponsesApi::OPERATIONS') && Patch::OrderLineItemResponsesApi::OPERATIONS.include?(message)
60
+ Patch::OrderLineItemResponsesApi.new.send(message, *args)
63
61
  else
64
62
  super
65
63
  end
@@ -69,27 +67,27 @@ module Patch
69
67
  # @param [Hash] attributes Model attributes in the form of hash
70
68
  def initialize(attributes = {})
71
69
  if (!attributes.is_a?(Hash))
72
- fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::Allocation` initialize method"
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::OrderLineItemResponse` initialize method"
73
71
  end
74
72
 
75
73
  # check to see if the attribute exists and convert string to symbol for hash key
76
74
  attributes = attributes.each_with_object({}) { |(k, v), h|
77
75
  if (!self.class.attribute_map.key?(k.to_sym))
78
- fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::Allocation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::OrderLineItemResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
77
  end
80
78
  h[k.to_sym] = v
81
79
  }
82
80
 
83
- if attributes.key?(:'id')
84
- self.id = attributes[:'id']
81
+ if attributes.key?(:'success')
82
+ self.success = attributes[:'success']
85
83
  end
86
84
 
87
- if attributes.key?(:'production')
88
- self.production = attributes[:'production']
85
+ if attributes.key?(:'error')
86
+ self.error = attributes[:'error']
89
87
  end
90
88
 
91
- if attributes.key?(:'mass_g')
92
- self.mass_g = attributes[:'mass_g']
89
+ if attributes.key?(:'data')
90
+ self.data = attributes[:'data']
93
91
  end
94
92
  end
95
93
 
@@ -97,16 +95,12 @@ module Patch
97
95
  # @return Array for valid properties with the reasons
98
96
  def list_invalid_properties
99
97
  invalid_properties = Array.new
100
- if @id.nil?
101
- invalid_properties.push('invalid value for "id", id cannot be nil.')
98
+ if @success.nil?
99
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
102
100
  end
103
101
 
104
- if @production.nil?
105
- invalid_properties.push('invalid value for "production", production cannot be nil.')
106
- end
107
-
108
- if @mass_g.nil?
109
- invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
102
+ if @data.nil?
103
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
110
104
  end
111
105
 
112
106
  invalid_properties
@@ -115,9 +109,8 @@ module Patch
115
109
  # Check to see if the all the properties in the model are valid
116
110
  # @return true if the model is valid
117
111
  def valid?
118
- return false if @id.nil?
119
- return false if @production.nil?
120
- return false if @mass_g.nil?
112
+ return false if @success.nil?
113
+ return false if @data.nil?
121
114
  true
122
115
  end
123
116
 
@@ -126,9 +119,9 @@ module Patch
126
119
  def ==(o)
127
120
  return true if self.equal?(o)
128
121
  self.class == o.class &&
129
- id == o.id &&
130
- production == o.production &&
131
- mass_g == o.mass_g
122
+ success == o.success &&
123
+ error == o.error &&
124
+ data == o.data
132
125
  end
133
126
 
134
127
  # @see the `==` method
@@ -140,7 +133,7 @@ module Patch
140
133
  # Calculates hash code according to all attributes.
141
134
  # @return [Integer] Hash code
142
135
  def hash
143
- [id, production, mass_g].hash
136
+ [success, error, data].hash
144
137
  end
145
138
 
146
139
  # Builds the object from hash
@@ -1,9 +1,9 @@
1
1
  =begin
2
- #Patch API V1
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: v1
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 V1
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: v1
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 V1
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: v1
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 V1
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: v1
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 V1
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: v1
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