patch_ruby 1.23.0 → 1.24.2
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 +15 -0
- data/Gemfile.lock +1 -1
- data/README.md +11 -11
- data/lib/patch_ruby/api/estimates_api.rb +357 -7
- data/lib/patch_ruby/api/orders_api.rb +36 -36
- data/lib/patch_ruby/api/projects_api.rb +2 -2
- data/lib/patch_ruby/api_client.rb +1 -1
- data/lib/patch_ruby/models/create_air_shipping_estimate_request.rb +374 -0
- data/lib/patch_ruby/models/{v1_orders_issued_to.rb → create_ecommerce_estimate_request.rb} +154 -20
- data/lib/patch_ruby/models/create_order_request.rb +3 -4
- data/lib/patch_ruby/models/create_rail_shipping_estimate_request.rb +404 -0
- data/lib/patch_ruby/models/create_road_shipping_estimate_request.rb +507 -0
- data/lib/patch_ruby/models/create_sea_shipping_estimate_request.rb +461 -0
- data/lib/patch_ruby/models/order.rb +7 -3
- data/lib/patch_ruby/models/{issued_to.rb → order_issued_to.rb} +7 -7
- data/lib/patch_ruby/models/place_order_request.rb +1 -2
- data/lib/patch_ruby/models/project.rb +1 -1
- data/lib/patch_ruby/version.rb +1 -1
- data/lib/patch_ruby.rb +6 -2
- data/spec/integration/estimates_spec.rb +165 -1
- data/spec/integration/orders_spec.rb +3 -3
- data/spec/integration/projects_spec.rb +2 -2
- data/spec/models/create_order_request_spec.rb +1 -1
- metadata +31 -27
@@ -0,0 +1,461 @@
|
|
1
|
+
=begin
|
2
|
+
#Patch API V1
|
3
|
+
|
4
|
+
#The core API used to integrate with Patch's service
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v1
|
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 CreateSeaShippingEstimateRequest
|
18
|
+
attr_accessor :destination_country_code
|
19
|
+
|
20
|
+
attr_accessor :destination_locode
|
21
|
+
|
22
|
+
attr_accessor :destination_postal_code
|
23
|
+
|
24
|
+
attr_accessor :origin_country_code
|
25
|
+
|
26
|
+
attr_accessor :origin_locode
|
27
|
+
|
28
|
+
attr_accessor :origin_postal_code
|
29
|
+
|
30
|
+
attr_accessor :container_size_code
|
31
|
+
|
32
|
+
attr_accessor :emissions_scope
|
33
|
+
|
34
|
+
attr_accessor :freight_mass_g
|
35
|
+
|
36
|
+
attr_accessor :freight_volume_cubic_m
|
37
|
+
|
38
|
+
attr_accessor :number_of_containers
|
39
|
+
|
40
|
+
attr_accessor :vessel_imo
|
41
|
+
|
42
|
+
attr_accessor :project_id
|
43
|
+
|
44
|
+
attr_accessor :create_order
|
45
|
+
|
46
|
+
class EnumAttributeValidator
|
47
|
+
attr_reader :datatype
|
48
|
+
attr_reader :allowable_values
|
49
|
+
|
50
|
+
def initialize(datatype, allowable_values)
|
51
|
+
@allowable_values = allowable_values.map do |value|
|
52
|
+
case datatype.to_s
|
53
|
+
when /Integer/i
|
54
|
+
value.to_i
|
55
|
+
when /Float/i
|
56
|
+
value.to_f
|
57
|
+
else
|
58
|
+
value
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def valid?(value)
|
64
|
+
!value || allowable_values.include?(value)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
69
|
+
def self.attribute_map
|
70
|
+
{
|
71
|
+
:'destination_country_code' => :'destination_country_code',
|
72
|
+
:'destination_locode' => :'destination_locode',
|
73
|
+
:'destination_postal_code' => :'destination_postal_code',
|
74
|
+
:'origin_country_code' => :'origin_country_code',
|
75
|
+
:'origin_locode' => :'origin_locode',
|
76
|
+
:'origin_postal_code' => :'origin_postal_code',
|
77
|
+
:'container_size_code' => :'container_size_code',
|
78
|
+
:'emissions_scope' => :'emissions_scope',
|
79
|
+
:'freight_mass_g' => :'freight_mass_g',
|
80
|
+
:'freight_volume_cubic_m' => :'freight_volume_cubic_m',
|
81
|
+
:'number_of_containers' => :'number_of_containers',
|
82
|
+
:'vessel_imo' => :'vessel_imo',
|
83
|
+
:'project_id' => :'project_id',
|
84
|
+
:'create_order' => :'create_order'
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
# Returns all the JSON keys this model knows about
|
89
|
+
def self.acceptable_attributes
|
90
|
+
attribute_map.values
|
91
|
+
end
|
92
|
+
|
93
|
+
# Attribute type mapping.
|
94
|
+
def self.openapi_types
|
95
|
+
{
|
96
|
+
:'destination_country_code' => :'String',
|
97
|
+
:'destination_locode' => :'String',
|
98
|
+
:'destination_postal_code' => :'String',
|
99
|
+
:'origin_country_code' => :'String',
|
100
|
+
:'origin_locode' => :'String',
|
101
|
+
:'origin_postal_code' => :'String',
|
102
|
+
:'container_size_code' => :'String',
|
103
|
+
:'emissions_scope' => :'String',
|
104
|
+
:'freight_mass_g' => :'Integer',
|
105
|
+
:'freight_volume_cubic_m' => :'Integer',
|
106
|
+
:'number_of_containers' => :'Integer',
|
107
|
+
:'vessel_imo' => :'Integer',
|
108
|
+
:'project_id' => :'String',
|
109
|
+
:'create_order' => :'Boolean'
|
110
|
+
}
|
111
|
+
end
|
112
|
+
|
113
|
+
# List of attributes with nullable: true
|
114
|
+
def self.openapi_nullable
|
115
|
+
Set.new([
|
116
|
+
:'destination_country_code',
|
117
|
+
:'destination_locode',
|
118
|
+
:'destination_postal_code',
|
119
|
+
:'origin_country_code',
|
120
|
+
:'origin_locode',
|
121
|
+
:'origin_postal_code',
|
122
|
+
:'emissions_scope',
|
123
|
+
:'freight_volume_cubic_m',
|
124
|
+
:'number_of_containers',
|
125
|
+
:'vessel_imo',
|
126
|
+
:'project_id',
|
127
|
+
:'create_order'
|
128
|
+
])
|
129
|
+
end
|
130
|
+
|
131
|
+
|
132
|
+
# Allows models with corresponding API classes to delegate API operations to those API classes
|
133
|
+
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
134
|
+
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
135
|
+
def self.method_missing(message, *args, &block)
|
136
|
+
if Object.const_defined?('Patch::CreateSeaShippingEstimateRequestsApi::OPERATIONS') && Patch::CreateSeaShippingEstimateRequestsApi::OPERATIONS.include?(message)
|
137
|
+
Patch::CreateSeaShippingEstimateRequestsApi.new.send(message, *args)
|
138
|
+
else
|
139
|
+
super
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# Initializes the object
|
144
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
145
|
+
def initialize(attributes = {})
|
146
|
+
if (!attributes.is_a?(Hash))
|
147
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::CreateSeaShippingEstimateRequest` initialize method"
|
148
|
+
end
|
149
|
+
|
150
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
151
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
152
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
153
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::CreateSeaShippingEstimateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
154
|
+
end
|
155
|
+
h[k.to_sym] = v
|
156
|
+
}
|
157
|
+
|
158
|
+
if attributes.key?(:'destination_country_code')
|
159
|
+
self.destination_country_code = attributes[:'destination_country_code']
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes.key?(:'destination_locode')
|
163
|
+
self.destination_locode = attributes[:'destination_locode']
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes.key?(:'destination_postal_code')
|
167
|
+
self.destination_postal_code = attributes[:'destination_postal_code']
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes.key?(:'origin_country_code')
|
171
|
+
self.origin_country_code = attributes[:'origin_country_code']
|
172
|
+
end
|
173
|
+
|
174
|
+
if attributes.key?(:'origin_locode')
|
175
|
+
self.origin_locode = attributes[:'origin_locode']
|
176
|
+
end
|
177
|
+
|
178
|
+
if attributes.key?(:'origin_postal_code')
|
179
|
+
self.origin_postal_code = attributes[:'origin_postal_code']
|
180
|
+
end
|
181
|
+
|
182
|
+
if attributes.key?(:'container_size_code')
|
183
|
+
self.container_size_code = attributes[:'container_size_code']
|
184
|
+
end
|
185
|
+
|
186
|
+
if attributes.key?(:'emissions_scope')
|
187
|
+
self.emissions_scope = attributes[:'emissions_scope']
|
188
|
+
else
|
189
|
+
self.emissions_scope = 'ttw'
|
190
|
+
end
|
191
|
+
|
192
|
+
if attributes.key?(:'freight_mass_g')
|
193
|
+
self.freight_mass_g = attributes[:'freight_mass_g']
|
194
|
+
end
|
195
|
+
|
196
|
+
if attributes.key?(:'freight_volume_cubic_m')
|
197
|
+
self.freight_volume_cubic_m = attributes[:'freight_volume_cubic_m']
|
198
|
+
end
|
199
|
+
|
200
|
+
if attributes.key?(:'number_of_containers')
|
201
|
+
self.number_of_containers = attributes[:'number_of_containers']
|
202
|
+
end
|
203
|
+
|
204
|
+
if attributes.key?(:'vessel_imo')
|
205
|
+
self.vessel_imo = attributes[:'vessel_imo']
|
206
|
+
end
|
207
|
+
|
208
|
+
if attributes.key?(:'project_id')
|
209
|
+
self.project_id = attributes[:'project_id']
|
210
|
+
end
|
211
|
+
|
212
|
+
if attributes.key?(:'create_order')
|
213
|
+
self.create_order = attributes[:'create_order']
|
214
|
+
else
|
215
|
+
self.create_order = false
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
220
|
+
# @return Array for valid properties with the reasons
|
221
|
+
def list_invalid_properties
|
222
|
+
invalid_properties = Array.new
|
223
|
+
if !@freight_mass_g.nil? && @freight_mass_g > 2000000000
|
224
|
+
invalid_properties.push('invalid value for "freight_mass_g", must be smaller than or equal to 2000000000.')
|
225
|
+
end
|
226
|
+
|
227
|
+
if !@freight_mass_g.nil? && @freight_mass_g < 0
|
228
|
+
invalid_properties.push('invalid value for "freight_mass_g", must be greater than or equal to 0.')
|
229
|
+
end
|
230
|
+
|
231
|
+
if !@freight_volume_cubic_m.nil? && @freight_volume_cubic_m < 0
|
232
|
+
invalid_properties.push('invalid value for "freight_volume_cubic_m", must be greater than or equal to 0.')
|
233
|
+
end
|
234
|
+
|
235
|
+
if !@number_of_containers.nil? && @number_of_containers < 0
|
236
|
+
invalid_properties.push('invalid value for "number_of_containers", must be greater than or equal to 0.')
|
237
|
+
end
|
238
|
+
|
239
|
+
invalid_properties
|
240
|
+
end
|
241
|
+
|
242
|
+
# Check to see if the all the properties in the model are valid
|
243
|
+
# @return true if the model is valid
|
244
|
+
def valid?
|
245
|
+
container_size_code_validator = EnumAttributeValidator.new('String', ["20GP", "40GP", "22G1", "42G1", "40HC", "45G1"])
|
246
|
+
return false unless container_size_code_validator.valid?(@container_size_code)
|
247
|
+
emissions_scope_validator = EnumAttributeValidator.new('String', ["wtt", "ttw", "wtw"])
|
248
|
+
return false unless emissions_scope_validator.valid?(@emissions_scope)
|
249
|
+
return false if !@freight_mass_g.nil? && @freight_mass_g > 2000000000
|
250
|
+
return false if !@freight_mass_g.nil? && @freight_mass_g < 0
|
251
|
+
return false if !@freight_volume_cubic_m.nil? && @freight_volume_cubic_m < 0
|
252
|
+
return false if !@number_of_containers.nil? && @number_of_containers < 0
|
253
|
+
true
|
254
|
+
end
|
255
|
+
|
256
|
+
# Custom attribute writer method checking allowed values (enum).
|
257
|
+
# @param [Object] container_size_code Object to be assigned
|
258
|
+
def container_size_code=(container_size_code)
|
259
|
+
validator = EnumAttributeValidator.new('String', ["20GP", "40GP", "22G1", "42G1", "40HC", "45G1"])
|
260
|
+
unless validator.valid?(container_size_code)
|
261
|
+
fail ArgumentError, "invalid value for \"container_size_code\", must be one of #{validator.allowable_values}."
|
262
|
+
end
|
263
|
+
@container_size_code = container_size_code
|
264
|
+
end
|
265
|
+
|
266
|
+
# Custom attribute writer method checking allowed values (enum).
|
267
|
+
# @param [Object] emissions_scope Object to be assigned
|
268
|
+
def emissions_scope=(emissions_scope)
|
269
|
+
validator = EnumAttributeValidator.new('String', ["wtt", "ttw", "wtw"])
|
270
|
+
unless validator.valid?(emissions_scope)
|
271
|
+
fail ArgumentError, "invalid value for \"emissions_scope\", must be one of #{validator.allowable_values}."
|
272
|
+
end
|
273
|
+
@emissions_scope = emissions_scope
|
274
|
+
end
|
275
|
+
|
276
|
+
# Custom attribute writer method with validation
|
277
|
+
# @param [Object] freight_mass_g Value to be assigned
|
278
|
+
def freight_mass_g=(freight_mass_g)
|
279
|
+
if !freight_mass_g.nil? && freight_mass_g > 2000000000
|
280
|
+
fail ArgumentError, 'invalid value for "freight_mass_g", must be smaller than or equal to 2000000000.'
|
281
|
+
end
|
282
|
+
|
283
|
+
if !freight_mass_g.nil? && freight_mass_g < 0
|
284
|
+
fail ArgumentError, 'invalid value for "freight_mass_g", must be greater than or equal to 0.'
|
285
|
+
end
|
286
|
+
|
287
|
+
@freight_mass_g = freight_mass_g
|
288
|
+
end
|
289
|
+
|
290
|
+
# Custom attribute writer method with validation
|
291
|
+
# @param [Object] freight_volume_cubic_m Value to be assigned
|
292
|
+
def freight_volume_cubic_m=(freight_volume_cubic_m)
|
293
|
+
if !freight_volume_cubic_m.nil? && freight_volume_cubic_m < 0
|
294
|
+
fail ArgumentError, 'invalid value for "freight_volume_cubic_m", must be greater than or equal to 0.'
|
295
|
+
end
|
296
|
+
|
297
|
+
@freight_volume_cubic_m = freight_volume_cubic_m
|
298
|
+
end
|
299
|
+
|
300
|
+
# Custom attribute writer method with validation
|
301
|
+
# @param [Object] number_of_containers Value to be assigned
|
302
|
+
def number_of_containers=(number_of_containers)
|
303
|
+
if !number_of_containers.nil? && number_of_containers < 0
|
304
|
+
fail ArgumentError, 'invalid value for "number_of_containers", must be greater than or equal to 0.'
|
305
|
+
end
|
306
|
+
|
307
|
+
@number_of_containers = number_of_containers
|
308
|
+
end
|
309
|
+
|
310
|
+
# Checks equality by comparing each attribute.
|
311
|
+
# @param [Object] Object to be compared
|
312
|
+
def ==(o)
|
313
|
+
return true if self.equal?(o)
|
314
|
+
self.class == o.class &&
|
315
|
+
destination_country_code == o.destination_country_code &&
|
316
|
+
destination_locode == o.destination_locode &&
|
317
|
+
destination_postal_code == o.destination_postal_code &&
|
318
|
+
origin_country_code == o.origin_country_code &&
|
319
|
+
origin_locode == o.origin_locode &&
|
320
|
+
origin_postal_code == o.origin_postal_code &&
|
321
|
+
container_size_code == o.container_size_code &&
|
322
|
+
emissions_scope == o.emissions_scope &&
|
323
|
+
freight_mass_g == o.freight_mass_g &&
|
324
|
+
freight_volume_cubic_m == o.freight_volume_cubic_m &&
|
325
|
+
number_of_containers == o.number_of_containers &&
|
326
|
+
vessel_imo == o.vessel_imo &&
|
327
|
+
project_id == o.project_id &&
|
328
|
+
create_order == o.create_order
|
329
|
+
end
|
330
|
+
|
331
|
+
# @see the `==` method
|
332
|
+
# @param [Object] Object to be compared
|
333
|
+
def eql?(o)
|
334
|
+
self == o
|
335
|
+
end
|
336
|
+
|
337
|
+
# Calculates hash code according to all attributes.
|
338
|
+
# @return [Integer] Hash code
|
339
|
+
def hash
|
340
|
+
[destination_country_code, destination_locode, destination_postal_code, origin_country_code, origin_locode, origin_postal_code, container_size_code, emissions_scope, freight_mass_g, freight_volume_cubic_m, number_of_containers, vessel_imo, project_id, create_order].hash
|
341
|
+
end
|
342
|
+
|
343
|
+
# Builds the object from hash
|
344
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
345
|
+
# @return [Object] Returns the model itself
|
346
|
+
def self.build_from_hash(attributes)
|
347
|
+
new.build_from_hash(attributes)
|
348
|
+
end
|
349
|
+
|
350
|
+
# Builds the object from hash
|
351
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
352
|
+
# @return [Object] Returns the model itself
|
353
|
+
def build_from_hash(attributes)
|
354
|
+
return nil unless attributes.is_a?(Hash)
|
355
|
+
self.class.openapi_types.each_pair do |key, type|
|
356
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
357
|
+
self.send("#{key}=", nil)
|
358
|
+
elsif type =~ /\AArray<(.*)>/i
|
359
|
+
# check to ensure the input is an array given that the attribute
|
360
|
+
# is documented as an array but the input is not
|
361
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
362
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
363
|
+
end
|
364
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
365
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
self
|
370
|
+
end
|
371
|
+
|
372
|
+
# Deserializes the data based on type
|
373
|
+
# @param string type Data type
|
374
|
+
# @param string value Value to be deserialized
|
375
|
+
# @return [Object] Deserialized data
|
376
|
+
def _deserialize(type, value)
|
377
|
+
case type.to_sym
|
378
|
+
when :Time
|
379
|
+
Time.parse(value)
|
380
|
+
when :Date
|
381
|
+
Date.parse(value)
|
382
|
+
when :String
|
383
|
+
value.to_s
|
384
|
+
when :Integer
|
385
|
+
value.to_i
|
386
|
+
when :Float
|
387
|
+
value.to_f
|
388
|
+
when :Boolean
|
389
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
390
|
+
true
|
391
|
+
else
|
392
|
+
false
|
393
|
+
end
|
394
|
+
when :Object
|
395
|
+
# generic object (usually a Hash), return directly
|
396
|
+
value
|
397
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
398
|
+
inner_type = Regexp.last_match[:inner_type]
|
399
|
+
value.map { |v| _deserialize(inner_type, v) }
|
400
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
401
|
+
k_type = Regexp.last_match[:k_type]
|
402
|
+
v_type = Regexp.last_match[:v_type]
|
403
|
+
{}.tap do |hash|
|
404
|
+
value.each do |k, v|
|
405
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
406
|
+
end
|
407
|
+
end
|
408
|
+
else # model
|
409
|
+
# models (e.g. Pet) or oneOf
|
410
|
+
klass = Patch.const_get(type)
|
411
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
415
|
+
# Returns the string representation of the object
|
416
|
+
# @return [String] String presentation of the object
|
417
|
+
def to_s
|
418
|
+
to_hash.to_s
|
419
|
+
end
|
420
|
+
|
421
|
+
# to_body is an alias to to_hash (backward compatibility)
|
422
|
+
# @return [Hash] Returns the object in the form of hash
|
423
|
+
def to_body
|
424
|
+
to_hash
|
425
|
+
end
|
426
|
+
|
427
|
+
# Returns the object in the form of hash
|
428
|
+
# @return [Hash] Returns the object in the form of hash
|
429
|
+
def to_hash
|
430
|
+
hash = {}
|
431
|
+
self.class.attribute_map.each_pair do |attr, param|
|
432
|
+
value = self.send(attr)
|
433
|
+
if value.nil?
|
434
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
435
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
436
|
+
end
|
437
|
+
|
438
|
+
hash[param] = _to_hash(value)
|
439
|
+
end
|
440
|
+
hash
|
441
|
+
end
|
442
|
+
|
443
|
+
# Outputs non-array value in the form of hash
|
444
|
+
# For object, use to_hash. Otherwise, just return the value
|
445
|
+
# @param [Object] value Any valid value
|
446
|
+
# @return [Hash] Returns the value in the form of hash
|
447
|
+
def _to_hash(value)
|
448
|
+
if value.is_a?(Array)
|
449
|
+
value.compact.map { |v| _to_hash(v) }
|
450
|
+
elsif value.is_a?(Hash)
|
451
|
+
{}.tap do |hash|
|
452
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
453
|
+
end
|
454
|
+
elsif value.respond_to? :to_hash
|
455
|
+
value.to_hash
|
456
|
+
else
|
457
|
+
value
|
458
|
+
end
|
459
|
+
end
|
460
|
+
end
|
461
|
+
end
|
@@ -66,6 +66,7 @@ module Patch
|
|
66
66
|
# An array containing the inventory allocated for this order. Inventory is grouped by project, vintage year, and price.
|
67
67
|
attr_accessor :inventory
|
68
68
|
|
69
|
+
# An object containing the name & email of the party the inventory will be issued to.
|
69
70
|
attr_accessor :issued_to
|
70
71
|
|
71
72
|
class EnumAttributeValidator
|
@@ -139,7 +140,7 @@ module Patch
|
|
139
140
|
:'registry_url' => :'String',
|
140
141
|
:'metadata' => :'Object',
|
141
142
|
:'inventory' => :'Array<OrderInventory>',
|
142
|
-
:'issued_to' => :'
|
143
|
+
:'issued_to' => :'OrderIssuedTo'
|
143
144
|
}
|
144
145
|
end
|
145
146
|
|
@@ -251,6 +252,9 @@ module Patch
|
|
251
252
|
end
|
252
253
|
|
253
254
|
if attributes.key?(:'issued_to')
|
255
|
+
if (value = attributes[:'issued_to']).is_a?(Hash)
|
256
|
+
self.issued_to = value
|
257
|
+
end
|
254
258
|
self.issued_to = attributes[:'issued_to']
|
255
259
|
end
|
256
260
|
end
|
@@ -331,7 +335,7 @@ module Patch
|
|
331
335
|
return false if @mass_g < 0
|
332
336
|
return false if @production.nil?
|
333
337
|
return false if @state.nil?
|
334
|
-
state_validator = EnumAttributeValidator.new('String', ["draft", "placed", "processing", "complete", "cancelled"])
|
338
|
+
state_validator = EnumAttributeValidator.new('String', ["draft", "reserved", "placed", "processing", "complete", "cancelled"])
|
335
339
|
return false unless state_validator.valid?(@state)
|
336
340
|
return false if @amount.nil?
|
337
341
|
return false if @amount > 100000000000
|
@@ -368,7 +372,7 @@ module Patch
|
|
368
372
|
# Custom attribute writer method checking allowed values (enum).
|
369
373
|
# @param [Object] state Object to be assigned
|
370
374
|
def state=(state)
|
371
|
-
validator = EnumAttributeValidator.new('String', ["draft", "placed", "processing", "complete", "cancelled"])
|
375
|
+
validator = EnumAttributeValidator.new('String', ["draft", "reserved", "placed", "processing", "complete", "cancelled"])
|
372
376
|
unless validator.valid?(state)
|
373
377
|
fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}."
|
374
378
|
end
|
@@ -15,11 +15,11 @@ require 'time'
|
|
15
15
|
|
16
16
|
module Patch
|
17
17
|
# An object containing the name & email of the party the inventory will be issued to.
|
18
|
-
class
|
19
|
-
#
|
18
|
+
class OrderIssuedTo
|
19
|
+
# The name of the issuee
|
20
20
|
attr_accessor :name
|
21
21
|
|
22
|
-
#
|
22
|
+
# The email address of the issuee
|
23
23
|
attr_accessor :email
|
24
24
|
|
25
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -56,8 +56,8 @@ module Patch
|
|
56
56
|
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
57
57
|
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
58
58
|
def self.method_missing(message, *args, &block)
|
59
|
-
if Object.const_defined?('Patch::
|
60
|
-
Patch::
|
59
|
+
if Object.const_defined?('Patch::OrderIssuedTosApi::OPERATIONS') && Patch::OrderIssuedTosApi::OPERATIONS.include?(message)
|
60
|
+
Patch::OrderIssuedTosApi.new.send(message, *args)
|
61
61
|
else
|
62
62
|
super
|
63
63
|
end
|
@@ -67,13 +67,13 @@ module Patch
|
|
67
67
|
# @param [Hash] attributes Model attributes in the form of hash
|
68
68
|
def initialize(attributes = {})
|
69
69
|
if (!attributes.is_a?(Hash))
|
70
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::
|
70
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::OrderIssuedTo` initialize method"
|
71
71
|
end
|
72
72
|
|
73
73
|
# check to see if the attribute exists and convert string to symbol for hash key
|
74
74
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
75
75
|
if (!self.class.attribute_map.key?(k.to_sym))
|
76
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::
|
76
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::OrderIssuedTo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
77
77
|
end
|
78
78
|
h[k.to_sym] = v
|
79
79
|
}
|
@@ -32,14 +32,13 @@ module Patch
|
|
32
32
|
# Attribute type mapping.
|
33
33
|
def self.openapi_types
|
34
34
|
{
|
35
|
-
:'issued_to' => :'
|
35
|
+
:'issued_to' => :'OrderIssuedTo'
|
36
36
|
}
|
37
37
|
end
|
38
38
|
|
39
39
|
# List of attributes with nullable: true
|
40
40
|
def self.openapi_nullable
|
41
41
|
Set.new([
|
42
|
-
:'issued_to'
|
43
42
|
])
|
44
43
|
end
|
45
44
|
|
@@ -30,7 +30,7 @@ module Patch
|
|
30
30
|
# DEPRECATED. Favor the technology_type field instead.
|
31
31
|
attr_accessor :type
|
32
32
|
|
33
|
-
# The mechanism of the project.
|
33
|
+
# The mechanism of the project. One of: removal, avoidance, avoidance_and_removal.
|
34
34
|
attr_accessor :mechanism
|
35
35
|
|
36
36
|
# The country of origin of the project.
|
data/lib/patch_ruby/version.rb
CHANGED
data/lib/patch_ruby.rb
CHANGED
@@ -18,12 +18,17 @@ require 'patch_ruby/configuration'
|
|
18
18
|
|
19
19
|
# Models
|
20
20
|
require 'patch_ruby/models/allocation'
|
21
|
+
require 'patch_ruby/models/create_air_shipping_estimate_request'
|
21
22
|
require 'patch_ruby/models/create_bitcoin_estimate_request'
|
23
|
+
require 'patch_ruby/models/create_ecommerce_estimate_request'
|
22
24
|
require 'patch_ruby/models/create_ethereum_estimate_request'
|
23
25
|
require 'patch_ruby/models/create_flight_estimate_request'
|
24
26
|
require 'patch_ruby/models/create_hotel_estimate_request'
|
25
27
|
require 'patch_ruby/models/create_mass_estimate_request'
|
26
28
|
require 'patch_ruby/models/create_order_request'
|
29
|
+
require 'patch_ruby/models/create_rail_shipping_estimate_request'
|
30
|
+
require 'patch_ruby/models/create_road_shipping_estimate_request'
|
31
|
+
require 'patch_ruby/models/create_sea_shipping_estimate_request'
|
27
32
|
require 'patch_ruby/models/create_shipping_estimate_request'
|
28
33
|
require 'patch_ruby/models/create_success_response'
|
29
34
|
require 'patch_ruby/models/create_vehicle_estimate_request'
|
@@ -33,11 +38,11 @@ require 'patch_ruby/models/estimate_list_response'
|
|
33
38
|
require 'patch_ruby/models/estimate_response'
|
34
39
|
require 'patch_ruby/models/highlight'
|
35
40
|
require 'patch_ruby/models/inventory'
|
36
|
-
require 'patch_ruby/models/issued_to'
|
37
41
|
require 'patch_ruby/models/meta_index_object'
|
38
42
|
require 'patch_ruby/models/order'
|
39
43
|
require 'patch_ruby/models/order_inventory'
|
40
44
|
require 'patch_ruby/models/order_inventory_project'
|
45
|
+
require 'patch_ruby/models/order_issued_to'
|
41
46
|
require 'patch_ruby/models/order_list_response'
|
42
47
|
require 'patch_ruby/models/order_response'
|
43
48
|
require 'patch_ruby/models/parent_technology_type'
|
@@ -50,7 +55,6 @@ require 'patch_ruby/models/sdg'
|
|
50
55
|
require 'patch_ruby/models/standard'
|
51
56
|
require 'patch_ruby/models/technology_type'
|
52
57
|
require 'patch_ruby/models/technology_type_list_response'
|
53
|
-
require 'patch_ruby/models/v1_orders_issued_to'
|
54
58
|
|
55
59
|
# APIs
|
56
60
|
require 'patch_ruby/api/estimates_api'
|