patch_ruby 2.4.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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +18 -25
  5. data/README.md +0 -56
  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 -11
  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 +17 -48
  13. data/lib/patch_ruby/api/estimates_api.rb +0 -687
  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_flight_estimate_request.rb +0 -325
  17. data/lib/patch_ruby/models/create_mass_estimate_request.rb +0 -282
  18. data/lib/patch_ruby/models/create_rail_shipping_estimate_request.rb +0 -404
  19. data/lib/patch_ruby/models/create_road_shipping_estimate_request.rb +0 -517
  20. data/lib/patch_ruby/models/create_sea_shipping_estimate_request.rb +0 -461
  21. data/lib/patch_ruby/models/estimate.rb +0 -288
  22. data/lib/patch_ruby/models/estimate_list_response.rb +0 -273
  23. data/lib/patch_ruby/models/estimate_response.rb +0 -257
  24. data/spec/api/estimates_api_spec.rb +0 -70
  25. data/spec/factories/create_mass_estimate_requests.rb +0 -6
  26. data/spec/factories/estimate_list_responses.rb +0 -8
  27. data/spec/factories/estimate_responses.rb +0 -7
  28. data/spec/factories/estimates.rb +0 -8
  29. data/spec/integration/estimates_spec.rb +0 -244
  30. data/spec/models/create_mass_estimate_request_spec.rb +0 -46
  31. data/spec/models/estimate_list_response_spec.rb +0 -64
  32. data/spec/models/estimate_response_spec.rb +0 -58
  33. data/spec/models/estimate_spec.rb +0 -65
@@ -1,325 +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 CreateFlightEstimateRequest
18
- attr_accessor :distance_m
19
-
20
- attr_accessor :origin_airport
21
-
22
- attr_accessor :destination_airport
23
-
24
- attr_accessor :aircraft_code
25
-
26
- attr_accessor :cabin_class
27
-
28
- attr_accessor :passenger_count
29
-
30
- attr_accessor :project_id
31
-
32
- attr_accessor :create_order
33
-
34
- # Attribute mapping from ruby-style variable name to JSON key.
35
- def self.attribute_map
36
- {
37
- :'distance_m' => :'distance_m',
38
- :'origin_airport' => :'origin_airport',
39
- :'destination_airport' => :'destination_airport',
40
- :'aircraft_code' => :'aircraft_code',
41
- :'cabin_class' => :'cabin_class',
42
- :'passenger_count' => :'passenger_count',
43
- :'project_id' => :'project_id',
44
- :'create_order' => :'create_order'
45
- }
46
- end
47
-
48
- # Returns all the JSON keys this model knows about
49
- def self.acceptable_attributes
50
- attribute_map.values
51
- end
52
-
53
- # Attribute type mapping.
54
- def self.openapi_types
55
- {
56
- :'distance_m' => :'Integer',
57
- :'origin_airport' => :'String',
58
- :'destination_airport' => :'String',
59
- :'aircraft_code' => :'String',
60
- :'cabin_class' => :'String',
61
- :'passenger_count' => :'Integer',
62
- :'project_id' => :'String',
63
- :'create_order' => :'Boolean'
64
- }
65
- end
66
-
67
- # List of attributes with nullable: true
68
- def self.openapi_nullable
69
- Set.new([
70
- :'distance_m',
71
- :'origin_airport',
72
- :'destination_airport',
73
- :'aircraft_code',
74
- :'cabin_class',
75
- :'passenger_count',
76
- :'project_id',
77
- :'create_order'
78
- ])
79
- end
80
-
81
-
82
- # Allows models with corresponding API classes to delegate API operations to those API classes
83
- # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
84
- # Eg. Order.create_order delegates to OrdersApi.new.create_order
85
- def self.method_missing(message, *args, &block)
86
- if Object.const_defined?('Patch::CreateFlightEstimateRequestsApi::OPERATIONS') && Patch::CreateFlightEstimateRequestsApi::OPERATIONS.include?(message)
87
- Patch::CreateFlightEstimateRequestsApi.new.send(message, *args)
88
- else
89
- super
90
- end
91
- end
92
-
93
- # Initializes the object
94
- # @param [Hash] attributes Model attributes in the form of hash
95
- def initialize(attributes = {})
96
- if (!attributes.is_a?(Hash))
97
- fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::CreateFlightEstimateRequest` initialize method"
98
- end
99
-
100
- # check to see if the attribute exists and convert string to symbol for hash key
101
- attributes = attributes.each_with_object({}) { |(k, v), h|
102
- if (!self.class.attribute_map.key?(k.to_sym))
103
- fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::CreateFlightEstimateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
- end
105
- h[k.to_sym] = v
106
- }
107
-
108
- if attributes.key?(:'distance_m')
109
- self.distance_m = attributes[:'distance_m']
110
- end
111
-
112
- if attributes.key?(:'origin_airport')
113
- self.origin_airport = attributes[:'origin_airport']
114
- end
115
-
116
- if attributes.key?(:'destination_airport')
117
- self.destination_airport = attributes[:'destination_airport']
118
- end
119
-
120
- if attributes.key?(:'aircraft_code')
121
- self.aircraft_code = attributes[:'aircraft_code']
122
- end
123
-
124
- if attributes.key?(:'cabin_class')
125
- self.cabin_class = attributes[:'cabin_class']
126
- end
127
-
128
- if attributes.key?(:'passenger_count')
129
- self.passenger_count = attributes[:'passenger_count']
130
- end
131
-
132
- if attributes.key?(:'project_id')
133
- self.project_id = attributes[:'project_id']
134
- end
135
-
136
- if attributes.key?(:'create_order')
137
- self.create_order = attributes[:'create_order']
138
- else
139
- self.create_order = false
140
- end
141
- end
142
-
143
- # Show invalid properties with the reasons. Usually used together with valid?
144
- # @return Array for valid properties with the reasons
145
- def list_invalid_properties
146
- invalid_properties = Array.new
147
- if !@distance_m.nil? && @distance_m > 400000000
148
- invalid_properties.push('invalid value for "distance_m", must be smaller than or equal to 400000000.')
149
- end
150
-
151
- if !@distance_m.nil? && @distance_m < 0
152
- invalid_properties.push('invalid value for "distance_m", must be greater than or equal to 0.')
153
- end
154
-
155
- invalid_properties
156
- end
157
-
158
- # Check to see if the all the properties in the model are valid
159
- # @return true if the model is valid
160
- def valid?
161
- return false if !@distance_m.nil? && @distance_m > 400000000
162
- return false if !@distance_m.nil? && @distance_m < 0
163
- true
164
- end
165
-
166
- # Custom attribute writer method with validation
167
- # @param [Object] distance_m Value to be assigned
168
- def distance_m=(distance_m)
169
- if !distance_m.nil? && distance_m > 400000000
170
- fail ArgumentError, 'invalid value for "distance_m", must be smaller than or equal to 400000000.'
171
- end
172
-
173
- if !distance_m.nil? && distance_m < 0
174
- fail ArgumentError, 'invalid value for "distance_m", must be greater than or equal to 0.'
175
- end
176
-
177
- @distance_m = distance_m
178
- end
179
-
180
- # Checks equality by comparing each attribute.
181
- # @param [Object] Object to be compared
182
- def ==(o)
183
- return true if self.equal?(o)
184
- self.class == o.class &&
185
- distance_m == o.distance_m &&
186
- origin_airport == o.origin_airport &&
187
- destination_airport == o.destination_airport &&
188
- aircraft_code == o.aircraft_code &&
189
- cabin_class == o.cabin_class &&
190
- passenger_count == o.passenger_count &&
191
- project_id == o.project_id &&
192
- create_order == o.create_order
193
- end
194
-
195
- # @see the `==` method
196
- # @param [Object] Object to be compared
197
- def eql?(o)
198
- self == o
199
- end
200
-
201
- # Calculates hash code according to all attributes.
202
- # @return [Integer] Hash code
203
- def hash
204
- [distance_m, origin_airport, destination_airport, aircraft_code, cabin_class, passenger_count, project_id, create_order].hash
205
- end
206
-
207
- # Builds the object from hash
208
- # @param [Hash] attributes Model attributes in the form of hash
209
- # @return [Object] Returns the model itself
210
- def self.build_from_hash(attributes)
211
- new.build_from_hash(attributes)
212
- end
213
-
214
- # Builds the object from hash
215
- # @param [Hash] attributes Model attributes in the form of hash
216
- # @return [Object] Returns the model itself
217
- def build_from_hash(attributes)
218
- return nil unless attributes.is_a?(Hash)
219
- self.class.openapi_types.each_pair do |key, type|
220
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
221
- self.send("#{key}=", nil)
222
- elsif type =~ /\AArray<(.*)>/i
223
- # check to ensure the input is an array given that the attribute
224
- # is documented as an array but the input is not
225
- if attributes[self.class.attribute_map[key]].is_a?(Array)
226
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
227
- end
228
- elsif !attributes[self.class.attribute_map[key]].nil?
229
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
230
- end
231
- end
232
-
233
- self
234
- end
235
-
236
- # Deserializes the data based on type
237
- # @param string type Data type
238
- # @param string value Value to be deserialized
239
- # @return [Object] Deserialized data
240
- def _deserialize(type, value)
241
- case type.to_sym
242
- when :Time
243
- Time.parse(value)
244
- when :Date
245
- Date.parse(value)
246
- when :String
247
- value.to_s
248
- when :Integer
249
- value.to_i
250
- when :Float
251
- value.to_f
252
- when :Boolean
253
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
254
- true
255
- else
256
- false
257
- end
258
- when :Object
259
- # generic object (usually a Hash), return directly
260
- value
261
- when /\AArray<(?<inner_type>.+)>\z/
262
- inner_type = Regexp.last_match[:inner_type]
263
- value.map { |v| _deserialize(inner_type, v) }
264
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
265
- k_type = Regexp.last_match[:k_type]
266
- v_type = Regexp.last_match[:v_type]
267
- {}.tap do |hash|
268
- value.each do |k, v|
269
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
270
- end
271
- end
272
- else # model
273
- # models (e.g. Pet) or oneOf
274
- klass = Patch.const_get(type)
275
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
276
- end
277
- end
278
-
279
- # Returns the string representation of the object
280
- # @return [String] String presentation of the object
281
- def to_s
282
- to_hash.to_s
283
- end
284
-
285
- # to_body is an alias to to_hash (backward compatibility)
286
- # @return [Hash] Returns the object in the form of hash
287
- def to_body
288
- to_hash
289
- end
290
-
291
- # Returns the object in the form of hash
292
- # @return [Hash] Returns the object in the form of hash
293
- def to_hash
294
- hash = {}
295
- self.class.attribute_map.each_pair do |attr, param|
296
- value = self.send(attr)
297
- if value.nil?
298
- is_nullable = self.class.openapi_nullable.include?(attr)
299
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
300
- end
301
-
302
- hash[param] = _to_hash(value)
303
- end
304
- hash
305
- end
306
-
307
- # Outputs non-array value in the form of hash
308
- # For object, use to_hash. Otherwise, just return the value
309
- # @param [Object] value Any valid value
310
- # @return [Hash] Returns the value in the form of hash
311
- def _to_hash(value)
312
- if value.is_a?(Array)
313
- value.compact.map { |v| _to_hash(v) }
314
- elsif value.is_a?(Hash)
315
- {}.tap do |hash|
316
- value.each { |k, v| hash[k] = _to_hash(v) }
317
- end
318
- elsif value.respond_to? :to_hash
319
- value.to_hash
320
- else
321
- value
322
- end
323
- end
324
- end
325
- end
@@ -1,282 +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 CreateMassEstimateRequest
18
- attr_accessor :mass_g
19
-
20
- attr_accessor :create_order
21
-
22
- attr_accessor :project_id
23
-
24
- # Attribute mapping from ruby-style variable name to JSON key.
25
- def self.attribute_map
26
- {
27
- :'mass_g' => :'mass_g',
28
- :'create_order' => :'create_order',
29
- :'project_id' => :'project_id'
30
- }
31
- end
32
-
33
- # Returns all the JSON keys this model knows about
34
- def self.acceptable_attributes
35
- attribute_map.values
36
- end
37
-
38
- # Attribute type mapping.
39
- def self.openapi_types
40
- {
41
- :'mass_g' => :'Integer',
42
- :'create_order' => :'Boolean',
43
- :'project_id' => :'String'
44
- }
45
- end
46
-
47
- # List of attributes with nullable: true
48
- def self.openapi_nullable
49
- Set.new([
50
- :'create_order',
51
- ])
52
- end
53
-
54
-
55
- # Allows models with corresponding API classes to delegate API operations to those API classes
56
- # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
57
- # Eg. Order.create_order delegates to OrdersApi.new.create_order
58
- def self.method_missing(message, *args, &block)
59
- if Object.const_defined?('Patch::CreateMassEstimateRequestsApi::OPERATIONS') && Patch::CreateMassEstimateRequestsApi::OPERATIONS.include?(message)
60
- Patch::CreateMassEstimateRequestsApi.new.send(message, *args)
61
- else
62
- super
63
- end
64
- end
65
-
66
- # Initializes the object
67
- # @param [Hash] attributes Model attributes in the form of hash
68
- def initialize(attributes = {})
69
- if (!attributes.is_a?(Hash))
70
- fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::CreateMassEstimateRequest` initialize method"
71
- end
72
-
73
- # check to see if the attribute exists and convert string to symbol for hash key
74
- attributes = attributes.each_with_object({}) { |(k, v), h|
75
- if (!self.class.attribute_map.key?(k.to_sym))
76
- fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::CreateMassEstimateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
- end
78
- h[k.to_sym] = v
79
- }
80
-
81
- if attributes.key?(:'mass_g')
82
- self.mass_g = attributes[:'mass_g']
83
- end
84
-
85
- if attributes.key?(:'create_order')
86
- self.create_order = attributes[:'create_order']
87
- else
88
- self.create_order = false
89
- end
90
-
91
- if attributes.key?(:'project_id')
92
- self.project_id = attributes[:'project_id']
93
- end
94
- end
95
-
96
- # Show invalid properties with the reasons. Usually used together with valid?
97
- # @return Array for valid properties with the reasons
98
- def list_invalid_properties
99
- invalid_properties = Array.new
100
- if @mass_g.nil?
101
- invalid_properties.push('invalid value for "mass_g", mass_g cannot be nil.')
102
- end
103
-
104
- if @mass_g > 100000000000000
105
- invalid_properties.push('invalid value for "mass_g", must be smaller than or equal to 100000000000000.')
106
- end
107
-
108
- if @mass_g < 0
109
- invalid_properties.push('invalid value for "mass_g", must be greater than or equal to 0.')
110
- end
111
-
112
- invalid_properties
113
- end
114
-
115
- # Check to see if the all the properties in the model are valid
116
- # @return true if the model is valid
117
- def valid?
118
- return false if @mass_g.nil?
119
- return false if @mass_g > 100000000000000
120
- return false if @mass_g < 0
121
- true
122
- end
123
-
124
- # Custom attribute writer method with validation
125
- # @param [Object] mass_g Value to be assigned
126
- def mass_g=(mass_g)
127
- if mass_g.nil?
128
- fail ArgumentError, 'mass_g cannot be nil'
129
- end
130
-
131
- if mass_g > 100000000000000
132
- fail ArgumentError, 'invalid value for "mass_g", must be smaller than or equal to 100000000000000.'
133
- end
134
-
135
- if mass_g < 0
136
- fail ArgumentError, 'invalid value for "mass_g", must be greater than or equal to 0.'
137
- end
138
-
139
- @mass_g = mass_g
140
- end
141
-
142
- # Checks equality by comparing each attribute.
143
- # @param [Object] Object to be compared
144
- def ==(o)
145
- return true if self.equal?(o)
146
- self.class == o.class &&
147
- mass_g == o.mass_g &&
148
- create_order == o.create_order &&
149
- project_id == o.project_id
150
- end
151
-
152
- # @see the `==` method
153
- # @param [Object] Object to be compared
154
- def eql?(o)
155
- self == o
156
- end
157
-
158
- # Calculates hash code according to all attributes.
159
- # @return [Integer] Hash code
160
- def hash
161
- [mass_g, create_order, project_id].hash
162
- end
163
-
164
- # Builds the object from hash
165
- # @param [Hash] attributes Model attributes in the form of hash
166
- # @return [Object] Returns the model itself
167
- def self.build_from_hash(attributes)
168
- new.build_from_hash(attributes)
169
- end
170
-
171
- # Builds the object from hash
172
- # @param [Hash] attributes Model attributes in the form of hash
173
- # @return [Object] Returns the model itself
174
- def build_from_hash(attributes)
175
- return nil unless attributes.is_a?(Hash)
176
- self.class.openapi_types.each_pair do |key, type|
177
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
178
- self.send("#{key}=", nil)
179
- elsif type =~ /\AArray<(.*)>/i
180
- # check to ensure the input is an array given that the attribute
181
- # is documented as an array but the input is not
182
- if attributes[self.class.attribute_map[key]].is_a?(Array)
183
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
184
- end
185
- elsif !attributes[self.class.attribute_map[key]].nil?
186
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
187
- end
188
- end
189
-
190
- self
191
- end
192
-
193
- # Deserializes the data based on type
194
- # @param string type Data type
195
- # @param string value Value to be deserialized
196
- # @return [Object] Deserialized data
197
- def _deserialize(type, value)
198
- case type.to_sym
199
- when :Time
200
- Time.parse(value)
201
- when :Date
202
- Date.parse(value)
203
- when :String
204
- value.to_s
205
- when :Integer
206
- value.to_i
207
- when :Float
208
- value.to_f
209
- when :Boolean
210
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
211
- true
212
- else
213
- false
214
- end
215
- when :Object
216
- # generic object (usually a Hash), return directly
217
- value
218
- when /\AArray<(?<inner_type>.+)>\z/
219
- inner_type = Regexp.last_match[:inner_type]
220
- value.map { |v| _deserialize(inner_type, v) }
221
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
222
- k_type = Regexp.last_match[:k_type]
223
- v_type = Regexp.last_match[:v_type]
224
- {}.tap do |hash|
225
- value.each do |k, v|
226
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
227
- end
228
- end
229
- else # model
230
- # models (e.g. Pet) or oneOf
231
- klass = Patch.const_get(type)
232
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
233
- end
234
- end
235
-
236
- # Returns the string representation of the object
237
- # @return [String] String presentation of the object
238
- def to_s
239
- to_hash.to_s
240
- end
241
-
242
- # to_body is an alias to to_hash (backward compatibility)
243
- # @return [Hash] Returns the object in the form of hash
244
- def to_body
245
- to_hash
246
- end
247
-
248
- # Returns the object in the form of hash
249
- # @return [Hash] Returns the object in the form of hash
250
- def to_hash
251
- hash = {}
252
- self.class.attribute_map.each_pair do |attr, param|
253
- value = self.send(attr)
254
- if value.nil?
255
- is_nullable = self.class.openapi_nullable.include?(attr)
256
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
257
- end
258
-
259
- hash[param] = _to_hash(value)
260
- end
261
- hash
262
- end
263
-
264
- # Outputs non-array value in the form of hash
265
- # For object, use to_hash. Otherwise, just return the value
266
- # @param [Object] value Any valid value
267
- # @return [Hash] Returns the value in the form of hash
268
- def _to_hash(value)
269
- if value.is_a?(Array)
270
- value.compact.map { |v| _to_hash(v) }
271
- elsif value.is_a?(Hash)
272
- {}.tap do |hash|
273
- value.each { |k, v| hash[k] = _to_hash(v) }
274
- end
275
- elsif value.respond_to? :to_hash
276
- value.to_hash
277
- else
278
- value
279
- end
280
- end
281
- end
282
- end