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