patch_ruby 1.10.0 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62e292f1c7070beccff4fc3add7f326fc1f08c1c5b843c7f0f0e022d40cd04de
4
- data.tar.gz: e4e1245f57a33e41a8d601a24cd795625db7f58fad1bc3858831497351e8943f
3
+ metadata.gz: 4a3355ae4c3a9439a8b1db277c94e30c60a3e114e4ab2c5076438ed497e60320
4
+ data.tar.gz: 6805d522a7f5121dc5fde2261572a3adb73284fb5ed0b1af43bb4cd9edec44bb
5
5
  SHA512:
6
- metadata.gz: 0e69a4cec4dba5b2206ee5ae361b62f3f58dc7d9aa1d2820d1a7774746ba1823824873ce99cbe2aaf4ef2184e8ecd16004d92da68ee1aadbb97a0b3186c586c2
7
- data.tar.gz: c49deb8e1a9ccdecd8a965deaf14d25d6cad5eaf2a17a7a19846ef49b6b501bb7a4dd4760d8f20c70cc0baea06055b176e959c2683252a69af77826efa305ddf
6
+ metadata.gz: 612a24be0c31029fb2d8aba73d663da451e733e7a7e3b89fb4d884cf2bd5967e0b0e97a196bb015884755fc2325806d41239ad33665d7bf93d2c16da0c618af1
7
+ data.tar.gz: d1fff96da8f5385e83a03c21a1752597390493752dcce51680ac82b29457928cd5430dc729412ae7712c7cb442b0f3e6f844d7fa17ebded2f51ccb51838ee046
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- patch_ruby (1.10.0)
4
+ patch_ruby (1.10.1)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
@@ -31,7 +31,7 @@ module Patch
31
31
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
32
32
  def initialize(config = Configuration.default)
33
33
  @config = config
34
- @user_agent = "patch-ruby/1.10.0"
34
+ @user_agent = "patch-ruby/1.10.1"
35
35
  @default_headers = {
36
36
  'Content-Type' => 'application/json',
37
37
  'User-Agent' => @user_agent
@@ -0,0 +1,281 @@
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: developers@usepatch.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.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 :project_id
21
+
22
+ attr_accessor :create_order
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'distance_m' => :'distance_m',
28
+ :'project_id' => :'project_id',
29
+ :'create_order' => :'create_order'
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
+ :'distance_m' => :'Integer',
42
+ :'project_id' => :'String',
43
+ :'create_order' => :'Boolean'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ :'project_id',
51
+ :'create_order'
52
+ ])
53
+ end
54
+
55
+
56
+ # Allows models with corresponding API classes to delegate API operations to those API classes
57
+ # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
58
+ # Eg. Order.create_order delegates to OrdersApi.new.create_order
59
+ def self.method_missing(message, *args, &block)
60
+ if Object.const_defined?('Patch::CreateFlightEstimateRequestsApi::OPERATIONS') && Patch::CreateFlightEstimateRequestsApi::OPERATIONS.include?(message)
61
+ Patch::CreateFlightEstimateRequestsApi.new.send(message, *args)
62
+ else
63
+ super
64
+ end
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::CreateFlightEstimateRequest` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ 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
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'distance_m')
83
+ self.distance_m = attributes[:'distance_m']
84
+ end
85
+
86
+ if attributes.key?(:'project_id')
87
+ self.project_id = attributes[:'project_id']
88
+ end
89
+
90
+ if attributes.key?(:'create_order')
91
+ self.create_order = attributes[:'create_order']
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ invalid_properties = Array.new
99
+ if @distance_m.nil?
100
+ invalid_properties.push('invalid value for "distance_m", distance_m cannot be nil.')
101
+ end
102
+
103
+ if @distance_m > 400000000
104
+ invalid_properties.push('invalid value for "distance_m", must be smaller than or equal to 400000000.')
105
+ end
106
+
107
+ if @distance_m < 0
108
+ invalid_properties.push('invalid value for "distance_m", must be greater than or equal to 0.')
109
+ end
110
+
111
+ invalid_properties
112
+ end
113
+
114
+ # Check to see if the all the properties in the model are valid
115
+ # @return true if the model is valid
116
+ def valid?
117
+ return false if @distance_m.nil?
118
+ return false if @distance_m > 400000000
119
+ return false if @distance_m < 0
120
+ true
121
+ end
122
+
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] distance_m Value to be assigned
125
+ def distance_m=(distance_m)
126
+ if distance_m.nil?
127
+ fail ArgumentError, 'distance_m cannot be nil'
128
+ end
129
+
130
+ if distance_m > 400000000
131
+ fail ArgumentError, 'invalid value for "distance_m", must be smaller than or equal to 400000000.'
132
+ end
133
+
134
+ if distance_m < 0
135
+ fail ArgumentError, 'invalid value for "distance_m", must be greater than or equal to 0.'
136
+ end
137
+
138
+ @distance_m = distance_m
139
+ end
140
+
141
+ # Checks equality by comparing each attribute.
142
+ # @param [Object] Object to be compared
143
+ def ==(o)
144
+ return true if self.equal?(o)
145
+ self.class == o.class &&
146
+ distance_m == o.distance_m &&
147
+ project_id == o.project_id &&
148
+ create_order == o.create_order
149
+ end
150
+
151
+ # @see the `==` method
152
+ # @param [Object] Object to be compared
153
+ def eql?(o)
154
+ self == o
155
+ end
156
+
157
+ # Calculates hash code according to all attributes.
158
+ # @return [Integer] Hash code
159
+ def hash
160
+ [distance_m, project_id, create_order].hash
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def self.build_from_hash(attributes)
167
+ new.build_from_hash(attributes)
168
+ end
169
+
170
+ # Builds the object from hash
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ # @return [Object] Returns the model itself
173
+ def build_from_hash(attributes)
174
+ return nil unless attributes.is_a?(Hash)
175
+ self.class.openapi_types.each_pair do |key, type|
176
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
177
+ self.send("#{key}=", nil)
178
+ elsif type =~ /\AArray<(.*)>/i
179
+ # check to ensure the input is an array given that the attribute
180
+ # is documented as an array but the input is not
181
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
182
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
183
+ end
184
+ elsif !attributes[self.class.attribute_map[key]].nil?
185
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
186
+ end
187
+ end
188
+
189
+ self
190
+ end
191
+
192
+ # Deserializes the data based on type
193
+ # @param string type Data type
194
+ # @param string value Value to be deserialized
195
+ # @return [Object] Deserialized data
196
+ def _deserialize(type, value)
197
+ case type.to_sym
198
+ when :Time
199
+ Time.parse(value)
200
+ when :Date
201
+ Date.parse(value)
202
+ when :String
203
+ value.to_s
204
+ when :Integer
205
+ value.to_i
206
+ when :Float
207
+ value.to_f
208
+ when :Boolean
209
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
210
+ true
211
+ else
212
+ false
213
+ end
214
+ when :Object
215
+ # generic object (usually a Hash), return directly
216
+ value
217
+ when /\AArray<(?<inner_type>.+)>\z/
218
+ inner_type = Regexp.last_match[:inner_type]
219
+ value.map { |v| _deserialize(inner_type, v) }
220
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
221
+ k_type = Regexp.last_match[:k_type]
222
+ v_type = Regexp.last_match[:v_type]
223
+ {}.tap do |hash|
224
+ value.each do |k, v|
225
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
226
+ end
227
+ end
228
+ else # model
229
+ # models (e.g. Pet) or oneOf
230
+ klass = Patch.const_get(type)
231
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
232
+ end
233
+ end
234
+
235
+ # Returns the string representation of the object
236
+ # @return [String] String presentation of the object
237
+ def to_s
238
+ to_hash.to_s
239
+ end
240
+
241
+ # to_body is an alias to to_hash (backward compatibility)
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_body
244
+ to_hash
245
+ end
246
+
247
+ # Returns the object in the form of hash
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_hash
250
+ hash = {}
251
+ self.class.attribute_map.each_pair do |attr, param|
252
+ value = self.send(attr)
253
+ if value.nil?
254
+ is_nullable = self.class.openapi_nullable.include?(attr)
255
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
256
+ end
257
+
258
+ hash[param] = _to_hash(value)
259
+ end
260
+ hash
261
+ end
262
+
263
+ # Outputs non-array value in the form of hash
264
+ # For object, use to_hash. Otherwise, just return the value
265
+ # @param [Object] value Any valid value
266
+ # @return [Hash] Returns the value in the form of hash
267
+ def _to_hash(value)
268
+ if value.is_a?(Array)
269
+ value.compact.map { |v| _to_hash(v) }
270
+ elsif value.is_a?(Hash)
271
+ {}.tap do |hash|
272
+ value.each { |k, v| hash[k] = _to_hash(v) }
273
+ end
274
+ elsif value.respond_to? :to_hash
275
+ value.to_hash
276
+ else
277
+ value
278
+ end
279
+ end
280
+ end
281
+ end
@@ -0,0 +1,371 @@
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: developers@usepatch.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Patch
17
+ class CreateShippingEstimateRequest
18
+ attr_accessor :distance_m
19
+
20
+ attr_accessor :package_mass_g
21
+
22
+ attr_accessor :transportation_method
23
+
24
+ attr_accessor :project_id
25
+
26
+ attr_accessor :create_order
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'distance_m' => :'distance_m',
54
+ :'package_mass_g' => :'package_mass_g',
55
+ :'transportation_method' => :'transportation_method',
56
+ :'project_id' => :'project_id',
57
+ :'create_order' => :'create_order'
58
+ }
59
+ end
60
+
61
+ # Returns all the JSON keys this model knows about
62
+ def self.acceptable_attributes
63
+ attribute_map.values
64
+ end
65
+
66
+ # Attribute type mapping.
67
+ def self.openapi_types
68
+ {
69
+ :'distance_m' => :'Integer',
70
+ :'package_mass_g' => :'Integer',
71
+ :'transportation_method' => :'String',
72
+ :'project_id' => :'String',
73
+ :'create_order' => :'Boolean'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ :'project_id',
81
+ :'create_order'
82
+ ])
83
+ end
84
+
85
+
86
+ # Allows models with corresponding API classes to delegate API operations to those API classes
87
+ # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
88
+ # Eg. Order.create_order delegates to OrdersApi.new.create_order
89
+ def self.method_missing(message, *args, &block)
90
+ if Object.const_defined?('Patch::CreateShippingEstimateRequestsApi::OPERATIONS') && Patch::CreateShippingEstimateRequestsApi::OPERATIONS.include?(message)
91
+ Patch::CreateShippingEstimateRequestsApi.new.send(message, *args)
92
+ else
93
+ super
94
+ end
95
+ end
96
+
97
+ # Initializes the object
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ def initialize(attributes = {})
100
+ if (!attributes.is_a?(Hash))
101
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::CreateShippingEstimateRequest` initialize method"
102
+ end
103
+
104
+ # check to see if the attribute exists and convert string to symbol for hash key
105
+ attributes = attributes.each_with_object({}) { |(k, v), h|
106
+ if (!self.class.attribute_map.key?(k.to_sym))
107
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::CreateShippingEstimateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
108
+ end
109
+ h[k.to_sym] = v
110
+ }
111
+
112
+ if attributes.key?(:'distance_m')
113
+ self.distance_m = attributes[:'distance_m']
114
+ end
115
+
116
+ if attributes.key?(:'package_mass_g')
117
+ self.package_mass_g = attributes[:'package_mass_g']
118
+ end
119
+
120
+ if attributes.key?(:'transportation_method')
121
+ self.transportation_method = attributes[:'transportation_method']
122
+ end
123
+
124
+ if attributes.key?(:'project_id')
125
+ self.project_id = attributes[:'project_id']
126
+ end
127
+
128
+ if attributes.key?(:'create_order')
129
+ self.create_order = attributes[:'create_order']
130
+ end
131
+ end
132
+
133
+ # Show invalid properties with the reasons. Usually used together with valid?
134
+ # @return Array for valid properties with the reasons
135
+ def list_invalid_properties
136
+ invalid_properties = Array.new
137
+ if @distance_m.nil?
138
+ invalid_properties.push('invalid value for "distance_m", distance_m cannot be nil.')
139
+ end
140
+
141
+ if @distance_m > 400000000
142
+ invalid_properties.push('invalid value for "distance_m", must be smaller than or equal to 400000000.')
143
+ end
144
+
145
+ if @distance_m < 0
146
+ invalid_properties.push('invalid value for "distance_m", must be greater than or equal to 0.')
147
+ end
148
+
149
+ if @package_mass_g.nil?
150
+ invalid_properties.push('invalid value for "package_mass_g", package_mass_g cannot be nil.')
151
+ end
152
+
153
+ if @package_mass_g > 2000000000
154
+ invalid_properties.push('invalid value for "package_mass_g", must be smaller than or equal to 2000000000.')
155
+ end
156
+
157
+ if @package_mass_g < 0
158
+ invalid_properties.push('invalid value for "package_mass_g", must be greater than or equal to 0.')
159
+ end
160
+
161
+ if @transportation_method.nil?
162
+ invalid_properties.push('invalid value for "transportation_method", transportation_method cannot be nil.')
163
+ end
164
+
165
+ invalid_properties
166
+ end
167
+
168
+ # Check to see if the all the properties in the model are valid
169
+ # @return true if the model is valid
170
+ def valid?
171
+ return false if @distance_m.nil?
172
+ return false if @distance_m > 400000000
173
+ return false if @distance_m < 0
174
+ return false if @package_mass_g.nil?
175
+ return false if @package_mass_g > 2000000000
176
+ return false if @package_mass_g < 0
177
+ return false if @transportation_method.nil?
178
+ transportation_method_validator = EnumAttributeValidator.new('String', ["air", "rail", "road", "sea"])
179
+ return false unless transportation_method_validator.valid?(@transportation_method)
180
+ true
181
+ end
182
+
183
+ # Custom attribute writer method with validation
184
+ # @param [Object] distance_m Value to be assigned
185
+ def distance_m=(distance_m)
186
+ if distance_m.nil?
187
+ fail ArgumentError, 'distance_m cannot be nil'
188
+ end
189
+
190
+ if distance_m > 400000000
191
+ fail ArgumentError, 'invalid value for "distance_m", must be smaller than or equal to 400000000.'
192
+ end
193
+
194
+ if distance_m < 0
195
+ fail ArgumentError, 'invalid value for "distance_m", must be greater than or equal to 0.'
196
+ end
197
+
198
+ @distance_m = distance_m
199
+ end
200
+
201
+ # Custom attribute writer method with validation
202
+ # @param [Object] package_mass_g Value to be assigned
203
+ def package_mass_g=(package_mass_g)
204
+ if package_mass_g.nil?
205
+ fail ArgumentError, 'package_mass_g cannot be nil'
206
+ end
207
+
208
+ if package_mass_g > 2000000000
209
+ fail ArgumentError, 'invalid value for "package_mass_g", must be smaller than or equal to 2000000000.'
210
+ end
211
+
212
+ if package_mass_g < 0
213
+ fail ArgumentError, 'invalid value for "package_mass_g", must be greater than or equal to 0.'
214
+ end
215
+
216
+ @package_mass_g = package_mass_g
217
+ end
218
+
219
+ # Custom attribute writer method checking allowed values (enum).
220
+ # @param [Object] transportation_method Object to be assigned
221
+ def transportation_method=(transportation_method)
222
+ validator = EnumAttributeValidator.new('String', ["air", "rail", "road", "sea"])
223
+ unless validator.valid?(transportation_method)
224
+ fail ArgumentError, "invalid value for \"transportation_method\", must be one of #{validator.allowable_values}."
225
+ end
226
+ @transportation_method = transportation_method
227
+ end
228
+
229
+ # Checks equality by comparing each attribute.
230
+ # @param [Object] Object to be compared
231
+ def ==(o)
232
+ return true if self.equal?(o)
233
+ self.class == o.class &&
234
+ distance_m == o.distance_m &&
235
+ package_mass_g == o.package_mass_g &&
236
+ transportation_method == o.transportation_method &&
237
+ project_id == o.project_id &&
238
+ create_order == o.create_order
239
+ end
240
+
241
+ # @see the `==` method
242
+ # @param [Object] Object to be compared
243
+ def eql?(o)
244
+ self == o
245
+ end
246
+
247
+ # Calculates hash code according to all attributes.
248
+ # @return [Integer] Hash code
249
+ def hash
250
+ [distance_m, package_mass_g, transportation_method, project_id, create_order].hash
251
+ end
252
+
253
+ # Builds the object from hash
254
+ # @param [Hash] attributes Model attributes in the form of hash
255
+ # @return [Object] Returns the model itself
256
+ def self.build_from_hash(attributes)
257
+ new.build_from_hash(attributes)
258
+ end
259
+
260
+ # Builds the object from hash
261
+ # @param [Hash] attributes Model attributes in the form of hash
262
+ # @return [Object] Returns the model itself
263
+ def build_from_hash(attributes)
264
+ return nil unless attributes.is_a?(Hash)
265
+ self.class.openapi_types.each_pair do |key, type|
266
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
267
+ self.send("#{key}=", nil)
268
+ elsif type =~ /\AArray<(.*)>/i
269
+ # check to ensure the input is an array given that the attribute
270
+ # is documented as an array but the input is not
271
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
272
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
273
+ end
274
+ elsif !attributes[self.class.attribute_map[key]].nil?
275
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
276
+ end
277
+ end
278
+
279
+ self
280
+ end
281
+
282
+ # Deserializes the data based on type
283
+ # @param string type Data type
284
+ # @param string value Value to be deserialized
285
+ # @return [Object] Deserialized data
286
+ def _deserialize(type, value)
287
+ case type.to_sym
288
+ when :Time
289
+ Time.parse(value)
290
+ when :Date
291
+ Date.parse(value)
292
+ when :String
293
+ value.to_s
294
+ when :Integer
295
+ value.to_i
296
+ when :Float
297
+ value.to_f
298
+ when :Boolean
299
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
300
+ true
301
+ else
302
+ false
303
+ end
304
+ when :Object
305
+ # generic object (usually a Hash), return directly
306
+ value
307
+ when /\AArray<(?<inner_type>.+)>\z/
308
+ inner_type = Regexp.last_match[:inner_type]
309
+ value.map { |v| _deserialize(inner_type, v) }
310
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
311
+ k_type = Regexp.last_match[:k_type]
312
+ v_type = Regexp.last_match[:v_type]
313
+ {}.tap do |hash|
314
+ value.each do |k, v|
315
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
316
+ end
317
+ end
318
+ else # model
319
+ # models (e.g. Pet) or oneOf
320
+ klass = Patch.const_get(type)
321
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
322
+ end
323
+ end
324
+
325
+ # Returns the string representation of the object
326
+ # @return [String] String presentation of the object
327
+ def to_s
328
+ to_hash.to_s
329
+ end
330
+
331
+ # to_body is an alias to to_hash (backward compatibility)
332
+ # @return [Hash] Returns the object in the form of hash
333
+ def to_body
334
+ to_hash
335
+ end
336
+
337
+ # Returns the object in the form of hash
338
+ # @return [Hash] Returns the object in the form of hash
339
+ def to_hash
340
+ hash = {}
341
+ self.class.attribute_map.each_pair do |attr, param|
342
+ value = self.send(attr)
343
+ if value.nil?
344
+ is_nullable = self.class.openapi_nullable.include?(attr)
345
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
346
+ end
347
+
348
+ hash[param] = _to_hash(value)
349
+ end
350
+ hash
351
+ end
352
+
353
+ # Outputs non-array value in the form of hash
354
+ # For object, use to_hash. Otherwise, just return the value
355
+ # @param [Object] value Any valid value
356
+ # @return [Hash] Returns the value in the form of hash
357
+ def _to_hash(value)
358
+ if value.is_a?(Array)
359
+ value.compact.map { |v| _to_hash(v) }
360
+ elsif value.is_a?(Hash)
361
+ {}.tap do |hash|
362
+ value.each { |k, v| hash[k] = _to_hash(v) }
363
+ end
364
+ elsif value.respond_to? :to_hash
365
+ value.to_hash
366
+ else
367
+ value
368
+ end
369
+ end
370
+ end
371
+ end
@@ -0,0 +1,247 @@
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: developers@usepatch.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Patch
17
+ class CreateSuccessResponse
18
+ attr_accessor :success
19
+
20
+ attr_accessor :error
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'success' => :'success',
26
+ :'error' => :'error'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'success' => :'Boolean',
39
+ :'error' => :'Object'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+
50
+ # Allows models with corresponding API classes to delegate API operations to those API classes
51
+ # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
52
+ # Eg. Order.create_order delegates to OrdersApi.new.create_order
53
+ def self.method_missing(message, *args, &block)
54
+ if Object.const_defined?('Patch::CreateSuccessResponsesApi::OPERATIONS') && Patch::CreateSuccessResponsesApi::OPERATIONS.include?(message)
55
+ Patch::CreateSuccessResponsesApi.new.send(message, *args)
56
+ else
57
+ super
58
+ end
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::CreateSuccessResponse` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::CreateSuccessResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'success')
77
+ self.success = attributes[:'success']
78
+ end
79
+
80
+ if attributes.key?(:'error')
81
+ self.error = attributes[:'error']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ if @success.nil?
90
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
91
+ end
92
+
93
+ if @error.nil?
94
+ invalid_properties.push('invalid value for "error", error cannot be nil.')
95
+ end
96
+
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ return false if @success.nil?
104
+ return false if @error.nil?
105
+ true
106
+ end
107
+
108
+ # Checks equality by comparing each attribute.
109
+ # @param [Object] Object to be compared
110
+ def ==(o)
111
+ return true if self.equal?(o)
112
+ self.class == o.class &&
113
+ success == o.success &&
114
+ error == o.error
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Integer] Hash code
125
+ def hash
126
+ [success, error].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def self.build_from_hash(attributes)
133
+ new.build_from_hash(attributes)
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ self.class.openapi_types.each_pair do |key, type|
142
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
143
+ self.send("#{key}=", nil)
144
+ elsif type =~ /\AArray<(.*)>/i
145
+ # check to ensure the input is an array given that the attribute
146
+ # is documented as an array but the input is not
147
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
148
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
149
+ end
150
+ elsif !attributes[self.class.attribute_map[key]].nil?
151
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
152
+ end
153
+ end
154
+
155
+ self
156
+ end
157
+
158
+ # Deserializes the data based on type
159
+ # @param string type Data type
160
+ # @param string value Value to be deserialized
161
+ # @return [Object] Deserialized data
162
+ def _deserialize(type, value)
163
+ case type.to_sym
164
+ when :Time
165
+ Time.parse(value)
166
+ when :Date
167
+ Date.parse(value)
168
+ when :String
169
+ value.to_s
170
+ when :Integer
171
+ value.to_i
172
+ when :Float
173
+ value.to_f
174
+ when :Boolean
175
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
+ true
177
+ else
178
+ false
179
+ end
180
+ when :Object
181
+ # generic object (usually a Hash), return directly
182
+ value
183
+ when /\AArray<(?<inner_type>.+)>\z/
184
+ inner_type = Regexp.last_match[:inner_type]
185
+ value.map { |v| _deserialize(inner_type, v) }
186
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
+ k_type = Regexp.last_match[:k_type]
188
+ v_type = Regexp.last_match[:v_type]
189
+ {}.tap do |hash|
190
+ value.each do |k, v|
191
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
192
+ end
193
+ end
194
+ else # model
195
+ # models (e.g. Pet) or oneOf
196
+ klass = Patch.const_get(type)
197
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+ end
247
+ end
@@ -0,0 +1,326 @@
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: developers@usepatch.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Patch
17
+ class CreateVehicleEstimateRequest
18
+ attr_accessor :distance_m
19
+
20
+ attr_accessor :make
21
+
22
+ attr_accessor :model
23
+
24
+ attr_accessor :year
25
+
26
+ attr_accessor :project_id
27
+
28
+ attr_accessor :create_order
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'distance_m' => :'distance_m',
34
+ :'make' => :'make',
35
+ :'model' => :'model',
36
+ :'year' => :'year',
37
+ :'project_id' => :'project_id',
38
+ :'create_order' => :'create_order'
39
+ }
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'distance_m' => :'Integer',
51
+ :'make' => :'String',
52
+ :'model' => :'String',
53
+ :'year' => :'Integer',
54
+ :'project_id' => :'String',
55
+ :'create_order' => :'Boolean'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ :'make',
63
+ :'model',
64
+ :'year',
65
+ :'project_id',
66
+ :'create_order'
67
+ ])
68
+ end
69
+
70
+
71
+ # Allows models with corresponding API classes to delegate API operations to those API classes
72
+ # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
73
+ # Eg. Order.create_order delegates to OrdersApi.new.create_order
74
+ def self.method_missing(message, *args, &block)
75
+ if Object.const_defined?('Patch::CreateVehicleEstimateRequestsApi::OPERATIONS') && Patch::CreateVehicleEstimateRequestsApi::OPERATIONS.include?(message)
76
+ Patch::CreateVehicleEstimateRequestsApi.new.send(message, *args)
77
+ else
78
+ super
79
+ end
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::CreateVehicleEstimateRequest` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h|
91
+ if (!self.class.attribute_map.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::CreateVehicleEstimateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
93
+ end
94
+ h[k.to_sym] = v
95
+ }
96
+
97
+ if attributes.key?(:'distance_m')
98
+ self.distance_m = attributes[:'distance_m']
99
+ end
100
+
101
+ if attributes.key?(:'make')
102
+ self.make = attributes[:'make']
103
+ end
104
+
105
+ if attributes.key?(:'model')
106
+ self.model = attributes[:'model']
107
+ end
108
+
109
+ if attributes.key?(:'year')
110
+ self.year = attributes[:'year']
111
+ end
112
+
113
+ if attributes.key?(:'project_id')
114
+ self.project_id = attributes[:'project_id']
115
+ end
116
+
117
+ if attributes.key?(:'create_order')
118
+ self.create_order = attributes[:'create_order']
119
+ end
120
+ end
121
+
122
+ # Show invalid properties with the reasons. Usually used together with valid?
123
+ # @return Array for valid properties with the reasons
124
+ def list_invalid_properties
125
+ invalid_properties = Array.new
126
+ if @distance_m.nil?
127
+ invalid_properties.push('invalid value for "distance_m", distance_m cannot be nil.')
128
+ end
129
+
130
+ if @distance_m > 400000000
131
+ invalid_properties.push('invalid value for "distance_m", must be smaller than or equal to 400000000.')
132
+ end
133
+
134
+ if @distance_m < 0
135
+ invalid_properties.push('invalid value for "distance_m", must be greater than or equal to 0.')
136
+ end
137
+
138
+ if !@year.nil? && @year < 1900
139
+ invalid_properties.push('invalid value for "year", must be greater than or equal to 1900.')
140
+ end
141
+
142
+ invalid_properties
143
+ end
144
+
145
+ # Check to see if the all the properties in the model are valid
146
+ # @return true if the model is valid
147
+ def valid?
148
+ return false if @distance_m.nil?
149
+ return false if @distance_m > 400000000
150
+ return false if @distance_m < 0
151
+ return false if !@year.nil? && @year < 1900
152
+ true
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] distance_m Value to be assigned
157
+ def distance_m=(distance_m)
158
+ if distance_m.nil?
159
+ fail ArgumentError, 'distance_m cannot be nil'
160
+ end
161
+
162
+ if distance_m > 400000000
163
+ fail ArgumentError, 'invalid value for "distance_m", must be smaller than or equal to 400000000.'
164
+ end
165
+
166
+ if distance_m < 0
167
+ fail ArgumentError, 'invalid value for "distance_m", must be greater than or equal to 0.'
168
+ end
169
+
170
+ @distance_m = distance_m
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] year Value to be assigned
175
+ def year=(year)
176
+ if !year.nil? && year < 1900
177
+ fail ArgumentError, 'invalid value for "year", must be greater than or equal to 1900.'
178
+ end
179
+
180
+ @year = year
181
+ end
182
+
183
+ # Checks equality by comparing each attribute.
184
+ # @param [Object] Object to be compared
185
+ def ==(o)
186
+ return true if self.equal?(o)
187
+ self.class == o.class &&
188
+ distance_m == o.distance_m &&
189
+ make == o.make &&
190
+ model == o.model &&
191
+ year == o.year &&
192
+ project_id == o.project_id &&
193
+ create_order == o.create_order
194
+ end
195
+
196
+ # @see the `==` method
197
+ # @param [Object] Object to be compared
198
+ def eql?(o)
199
+ self == o
200
+ end
201
+
202
+ # Calculates hash code according to all attributes.
203
+ # @return [Integer] Hash code
204
+ def hash
205
+ [distance_m, make, model, year, project_id, create_order].hash
206
+ end
207
+
208
+ # Builds the object from hash
209
+ # @param [Hash] attributes Model attributes in the form of hash
210
+ # @return [Object] Returns the model itself
211
+ def self.build_from_hash(attributes)
212
+ new.build_from_hash(attributes)
213
+ end
214
+
215
+ # Builds the object from hash
216
+ # @param [Hash] attributes Model attributes in the form of hash
217
+ # @return [Object] Returns the model itself
218
+ def build_from_hash(attributes)
219
+ return nil unless attributes.is_a?(Hash)
220
+ self.class.openapi_types.each_pair do |key, type|
221
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
222
+ self.send("#{key}=", nil)
223
+ elsif type =~ /\AArray<(.*)>/i
224
+ # check to ensure the input is an array given that the attribute
225
+ # is documented as an array but the input is not
226
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
227
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
228
+ end
229
+ elsif !attributes[self.class.attribute_map[key]].nil?
230
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
231
+ end
232
+ end
233
+
234
+ self
235
+ end
236
+
237
+ # Deserializes the data based on type
238
+ # @param string type Data type
239
+ # @param string value Value to be deserialized
240
+ # @return [Object] Deserialized data
241
+ def _deserialize(type, value)
242
+ case type.to_sym
243
+ when :Time
244
+ Time.parse(value)
245
+ when :Date
246
+ Date.parse(value)
247
+ when :String
248
+ value.to_s
249
+ when :Integer
250
+ value.to_i
251
+ when :Float
252
+ value.to_f
253
+ when :Boolean
254
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
255
+ true
256
+ else
257
+ false
258
+ end
259
+ when :Object
260
+ # generic object (usually a Hash), return directly
261
+ value
262
+ when /\AArray<(?<inner_type>.+)>\z/
263
+ inner_type = Regexp.last_match[:inner_type]
264
+ value.map { |v| _deserialize(inner_type, v) }
265
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
266
+ k_type = Regexp.last_match[:k_type]
267
+ v_type = Regexp.last_match[:v_type]
268
+ {}.tap do |hash|
269
+ value.each do |k, v|
270
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
271
+ end
272
+ end
273
+ else # model
274
+ # models (e.g. Pet) or oneOf
275
+ klass = Patch.const_get(type)
276
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
277
+ end
278
+ end
279
+
280
+ # Returns the string representation of the object
281
+ # @return [String] String presentation of the object
282
+ def to_s
283
+ to_hash.to_s
284
+ end
285
+
286
+ # to_body is an alias to to_hash (backward compatibility)
287
+ # @return [Hash] Returns the object in the form of hash
288
+ def to_body
289
+ to_hash
290
+ end
291
+
292
+ # Returns the object in the form of hash
293
+ # @return [Hash] Returns the object in the form of hash
294
+ def to_hash
295
+ hash = {}
296
+ self.class.attribute_map.each_pair do |attr, param|
297
+ value = self.send(attr)
298
+ if value.nil?
299
+ is_nullable = self.class.openapi_nullable.include?(attr)
300
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
301
+ end
302
+
303
+ hash[param] = _to_hash(value)
304
+ end
305
+ hash
306
+ end
307
+
308
+ # Outputs non-array value in the form of hash
309
+ # For object, use to_hash. Otherwise, just return the value
310
+ # @param [Object] value Any valid value
311
+ # @return [Hash] Returns the value in the form of hash
312
+ def _to_hash(value)
313
+ if value.is_a?(Array)
314
+ value.compact.map { |v| _to_hash(v) }
315
+ elsif value.is_a?(Hash)
316
+ {}.tap do |hash|
317
+ value.each { |k, v| hash[k] = _to_hash(v) }
318
+ end
319
+ elsif value.respond_to? :to_hash
320
+ value.to_hash
321
+ else
322
+ value
323
+ end
324
+ end
325
+ end
326
+ end
@@ -11,5 +11,5 @@ OpenAPI Generator version: 5.2.1
11
11
  =end
12
12
 
13
13
  module Patch
14
- VERSION = '1.10.0'
14
+ VERSION = '1.10.1'
15
15
  end
data/lib/patch_ruby.rb CHANGED
@@ -20,9 +20,13 @@ require 'patch_ruby/configuration'
20
20
  require 'patch_ruby/models/allocation'
21
21
  require 'patch_ruby/models/create_bitcoin_estimate_request'
22
22
  require 'patch_ruby/models/create_ethereum_estimate_request'
23
+ require 'patch_ruby/models/create_flight_estimate_request'
23
24
  require 'patch_ruby/models/create_mass_estimate_request'
24
25
  require 'patch_ruby/models/create_order_request'
25
26
  require 'patch_ruby/models/create_preference_request'
27
+ require 'patch_ruby/models/create_shipping_estimate_request'
28
+ require 'patch_ruby/models/create_success_response'
29
+ require 'patch_ruby/models/create_vehicle_estimate_request'
26
30
  require 'patch_ruby/models/error_response'
27
31
  require 'patch_ruby/models/estimate'
28
32
  require 'patch_ruby/models/estimate_list_response'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patch_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patch Technology
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-30 00:00:00.000000000 Z
11
+ date: 2021-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -89,9 +89,13 @@ files:
89
89
  - lib/patch_ruby/models/allocation.rb
90
90
  - lib/patch_ruby/models/create_bitcoin_estimate_request.rb
91
91
  - lib/patch_ruby/models/create_ethereum_estimate_request.rb
92
+ - lib/patch_ruby/models/create_flight_estimate_request.rb
92
93
  - lib/patch_ruby/models/create_mass_estimate_request.rb
93
94
  - lib/patch_ruby/models/create_order_request.rb
94
95
  - lib/patch_ruby/models/create_preference_request.rb
96
+ - lib/patch_ruby/models/create_shipping_estimate_request.rb
97
+ - lib/patch_ruby/models/create_success_response.rb
98
+ - lib/patch_ruby/models/create_vehicle_estimate_request.rb
95
99
  - lib/patch_ruby/models/error_response.rb
96
100
  - lib/patch_ruby/models/estimate.rb
97
101
  - lib/patch_ruby/models/estimate_list_response.rb