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,288 +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 Estimate
18
- # A unique uid for the record. UIDs will be prepended by est_prod or est_test depending on the mode it was created in.
19
- attr_accessor :id
20
-
21
- # A boolean indicating if this estimate is a production or demo mode estimate.
22
- attr_accessor :production
23
-
24
- # The type of estimate. Available types are mass, shipping, and crypto.
25
- attr_accessor :type
26
-
27
- # The estimated mass in grams for this estimate.
28
- attr_accessor :mass_g
29
-
30
- # An object returning the order associated with this estimate. See the [Order section](/?id=orders) for the full schema.
31
- attr_accessor :order
32
-
33
- # Attribute mapping from ruby-style variable name to JSON key.
34
- def self.attribute_map
35
- {
36
- :'id' => :'id',
37
- :'production' => :'production',
38
- :'type' => :'type',
39
- :'mass_g' => :'mass_g',
40
- :'order' => :'order'
41
- }
42
- end
43
-
44
- # Returns all the JSON keys this model knows about
45
- def self.acceptable_attributes
46
- attribute_map.values
47
- end
48
-
49
- # Attribute type mapping.
50
- def self.openapi_types
51
- {
52
- :'id' => :'String',
53
- :'production' => :'Boolean',
54
- :'type' => :'String',
55
- :'mass_g' => :'Integer',
56
- :'order' => :'Order'
57
- }
58
- end
59
-
60
- # List of attributes with nullable: true
61
- def self.openapi_nullable
62
- Set.new([
63
- :'order'
64
- ])
65
- end
66
-
67
-
68
- # Allows models with corresponding API classes to delegate API operations to those API classes
69
- # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
70
- # Eg. Order.create_order delegates to OrdersApi.new.create_order
71
- def self.method_missing(message, *args, &block)
72
- if Object.const_defined?('Patch::EstimatesApi::OPERATIONS') && Patch::EstimatesApi::OPERATIONS.include?(message)
73
- Patch::EstimatesApi.new.send(message, *args)
74
- else
75
- super
76
- end
77
- end
78
-
79
- # Initializes the object
80
- # @param [Hash] attributes Model attributes in the form of hash
81
- def initialize(attributes = {})
82
- if (!attributes.is_a?(Hash))
83
- fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::Estimate` initialize method"
84
- end
85
-
86
- # check to see if the attribute exists and convert string to symbol for hash key
87
- attributes = attributes.each_with_object({}) { |(k, v), h|
88
- if (!self.class.attribute_map.key?(k.to_sym))
89
- fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::Estimate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
- end
91
- h[k.to_sym] = v
92
- }
93
-
94
- if attributes.key?(:'id')
95
- self.id = attributes[:'id']
96
- end
97
-
98
- if attributes.key?(:'production')
99
- self.production = attributes[:'production']
100
- end
101
-
102
- if attributes.key?(:'type')
103
- self.type = attributes[:'type']
104
- end
105
-
106
- if attributes.key?(:'mass_g')
107
- self.mass_g = attributes[:'mass_g']
108
- end
109
-
110
- if attributes.key?(:'order')
111
- if (value = attributes[:'order']).is_a?(Hash)
112
- self.order = value
113
- end
114
- self.order = attributes[:'order']
115
- end
116
- end
117
-
118
- # Show invalid properties with the reasons. Usually used together with valid?
119
- # @return Array for valid properties with the reasons
120
- def list_invalid_properties
121
- invalid_properties = Array.new
122
- if @id.nil?
123
- invalid_properties.push('invalid value for "id", id cannot be nil.')
124
- end
125
-
126
- if @production.nil?
127
- invalid_properties.push('invalid value for "production", production cannot be nil.')
128
- end
129
-
130
- if @type.nil?
131
- invalid_properties.push('invalid value for "type", type cannot be nil.')
132
- end
133
-
134
- invalid_properties
135
- end
136
-
137
- # Check to see if the all the properties in the model are valid
138
- # @return true if the model is valid
139
- def valid?
140
- return false if @id.nil?
141
- return false if @production.nil?
142
- return false if @type.nil?
143
- true
144
- end
145
-
146
- # Checks equality by comparing each attribute.
147
- # @param [Object] Object to be compared
148
- def ==(o)
149
- return true if self.equal?(o)
150
- self.class == o.class &&
151
- id == o.id &&
152
- production == o.production &&
153
- type == o.type &&
154
- mass_g == o.mass_g &&
155
- order == o.order
156
- end
157
-
158
- # @see the `==` method
159
- # @param [Object] Object to be compared
160
- def eql?(o)
161
- self == o
162
- end
163
-
164
- # Calculates hash code according to all attributes.
165
- # @return [Integer] Hash code
166
- def hash
167
- [id, production, type, mass_g, order].hash
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 self.build_from_hash(attributes)
174
- new.build_from_hash(attributes)
175
- end
176
-
177
- # Builds the object from hash
178
- # @param [Hash] attributes Model attributes in the form of hash
179
- # @return [Object] Returns the model itself
180
- def build_from_hash(attributes)
181
- return nil unless attributes.is_a?(Hash)
182
- self.class.openapi_types.each_pair do |key, type|
183
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
184
- self.send("#{key}=", nil)
185
- elsif type =~ /\AArray<(.*)>/i
186
- # check to ensure the input is an array given that the attribute
187
- # is documented as an array but the input is not
188
- if attributes[self.class.attribute_map[key]].is_a?(Array)
189
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
190
- end
191
- elsif !attributes[self.class.attribute_map[key]].nil?
192
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
193
- end
194
- end
195
-
196
- self
197
- end
198
-
199
- # Deserializes the data based on type
200
- # @param string type Data type
201
- # @param string value Value to be deserialized
202
- # @return [Object] Deserialized data
203
- def _deserialize(type, value)
204
- case type.to_sym
205
- when :Time
206
- Time.parse(value)
207
- when :Date
208
- Date.parse(value)
209
- when :String
210
- value.to_s
211
- when :Integer
212
- value.to_i
213
- when :Float
214
- value.to_f
215
- when :Boolean
216
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
217
- true
218
- else
219
- false
220
- end
221
- when :Object
222
- # generic object (usually a Hash), return directly
223
- value
224
- when /\AArray<(?<inner_type>.+)>\z/
225
- inner_type = Regexp.last_match[:inner_type]
226
- value.map { |v| _deserialize(inner_type, v) }
227
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
228
- k_type = Regexp.last_match[:k_type]
229
- v_type = Regexp.last_match[:v_type]
230
- {}.tap do |hash|
231
- value.each do |k, v|
232
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
233
- end
234
- end
235
- else # model
236
- # models (e.g. Pet) or oneOf
237
- klass = Patch.const_get(type)
238
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
239
- end
240
- end
241
-
242
- # Returns the string representation of the object
243
- # @return [String] String presentation of the object
244
- def to_s
245
- to_hash.to_s
246
- end
247
-
248
- # to_body is an alias to to_hash (backward compatibility)
249
- # @return [Hash] Returns the object in the form of hash
250
- def to_body
251
- to_hash
252
- end
253
-
254
- # Returns the object in the form of hash
255
- # @return [Hash] Returns the object in the form of hash
256
- def to_hash
257
- hash = {}
258
- self.class.attribute_map.each_pair do |attr, param|
259
- value = self.send(attr)
260
- if value.nil?
261
- is_nullable = self.class.openapi_nullable.include?(attr)
262
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
263
- end
264
-
265
- hash[param] = _to_hash(value)
266
- end
267
- hash
268
- end
269
-
270
- # Outputs non-array value in the form of hash
271
- # For object, use to_hash. Otherwise, just return the value
272
- # @param [Object] value Any valid value
273
- # @return [Hash] Returns the value in the form of hash
274
- def _to_hash(value)
275
- if value.is_a?(Array)
276
- value.compact.map { |v| _to_hash(v) }
277
- elsif value.is_a?(Hash)
278
- {}.tap do |hash|
279
- value.each { |k, v| hash[k] = _to_hash(v) }
280
- end
281
- elsif value.respond_to? :to_hash
282
- value.to_hash
283
- else
284
- value
285
- end
286
- end
287
- end
288
- end
@@ -1,273 +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 EstimateListResponse
18
- attr_accessor :success
19
-
20
- attr_accessor :error
21
-
22
- attr_accessor :data
23
-
24
- attr_accessor :meta
25
-
26
- # Attribute mapping from ruby-style variable name to JSON key.
27
- def self.attribute_map
28
- {
29
- :'success' => :'success',
30
- :'error' => :'error',
31
- :'data' => :'data',
32
- :'meta' => :'meta'
33
- }
34
- end
35
-
36
- # Returns all the JSON keys this model knows about
37
- def self.acceptable_attributes
38
- attribute_map.values
39
- end
40
-
41
- # Attribute type mapping.
42
- def self.openapi_types
43
- {
44
- :'success' => :'Boolean',
45
- :'error' => :'Object',
46
- :'data' => :'Array<Estimate>',
47
- :'meta' => :'MetaIndexObject'
48
- }
49
- end
50
-
51
- # List of attributes with nullable: true
52
- def self.openapi_nullable
53
- Set.new([
54
- :'error',
55
- ])
56
- end
57
-
58
-
59
- # Allows models with corresponding API classes to delegate API operations to those API classes
60
- # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
61
- # Eg. Order.create_order delegates to OrdersApi.new.create_order
62
- def self.method_missing(message, *args, &block)
63
- if Object.const_defined?('Patch::EstimateListResponsesApi::OPERATIONS') && Patch::EstimateListResponsesApi::OPERATIONS.include?(message)
64
- Patch::EstimateListResponsesApi.new.send(message, *args)
65
- else
66
- super
67
- end
68
- end
69
-
70
- # Initializes the object
71
- # @param [Hash] attributes Model attributes in the form of hash
72
- def initialize(attributes = {})
73
- if (!attributes.is_a?(Hash))
74
- fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::EstimateListResponse` initialize method"
75
- end
76
-
77
- # check to see if the attribute exists and convert string to symbol for hash key
78
- attributes = attributes.each_with_object({}) { |(k, v), h|
79
- if (!self.class.attribute_map.key?(k.to_sym))
80
- fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::EstimateListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
81
- end
82
- h[k.to_sym] = v
83
- }
84
-
85
- if attributes.key?(:'success')
86
- self.success = attributes[:'success']
87
- end
88
-
89
- if attributes.key?(:'error')
90
- self.error = attributes[:'error']
91
- end
92
-
93
- if attributes.key?(:'data')
94
- if (value = attributes[:'data']).is_a?(Array)
95
- self.data = value
96
- end
97
- end
98
-
99
- if attributes.key?(:'meta')
100
- self.meta = attributes[:'meta']
101
- end
102
- end
103
-
104
- # Show invalid properties with the reasons. Usually used together with valid?
105
- # @return Array for valid properties with the reasons
106
- def list_invalid_properties
107
- invalid_properties = Array.new
108
- if @success.nil?
109
- invalid_properties.push('invalid value for "success", success cannot be nil.')
110
- end
111
-
112
- if @data.nil?
113
- invalid_properties.push('invalid value for "data", data cannot be nil.')
114
- end
115
-
116
- if @meta.nil?
117
- invalid_properties.push('invalid value for "meta", meta cannot be nil.')
118
- end
119
-
120
- invalid_properties
121
- end
122
-
123
- # Check to see if the all the properties in the model are valid
124
- # @return true if the model is valid
125
- def valid?
126
- return false if @success.nil?
127
- return false if @data.nil?
128
- return false if @meta.nil?
129
- true
130
- end
131
-
132
- # Checks equality by comparing each attribute.
133
- # @param [Object] Object to be compared
134
- def ==(o)
135
- return true if self.equal?(o)
136
- self.class == o.class &&
137
- success == o.success &&
138
- error == o.error &&
139
- data == o.data &&
140
- meta == o.meta
141
- end
142
-
143
- # @see the `==` method
144
- # @param [Object] Object to be compared
145
- def eql?(o)
146
- self == o
147
- end
148
-
149
- # Calculates hash code according to all attributes.
150
- # @return [Integer] Hash code
151
- def hash
152
- [success, error, data, meta].hash
153
- end
154
-
155
- # Builds the object from hash
156
- # @param [Hash] attributes Model attributes in the form of hash
157
- # @return [Object] Returns the model itself
158
- def self.build_from_hash(attributes)
159
- new.build_from_hash(attributes)
160
- end
161
-
162
- # Builds the object from hash
163
- # @param [Hash] attributes Model attributes in the form of hash
164
- # @return [Object] Returns the model itself
165
- def build_from_hash(attributes)
166
- return nil unless attributes.is_a?(Hash)
167
- self.class.openapi_types.each_pair do |key, type|
168
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
169
- self.send("#{key}=", nil)
170
- elsif type =~ /\AArray<(.*)>/i
171
- # check to ensure the input is an array given that the attribute
172
- # is documented as an array but the input is not
173
- if attributes[self.class.attribute_map[key]].is_a?(Array)
174
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
175
- end
176
- elsif !attributes[self.class.attribute_map[key]].nil?
177
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
178
- end
179
- end
180
-
181
- self
182
- end
183
-
184
- # Deserializes the data based on type
185
- # @param string type Data type
186
- # @param string value Value to be deserialized
187
- # @return [Object] Deserialized data
188
- def _deserialize(type, value)
189
- case type.to_sym
190
- when :Time
191
- Time.parse(value)
192
- when :Date
193
- Date.parse(value)
194
- when :String
195
- value.to_s
196
- when :Integer
197
- value.to_i
198
- when :Float
199
- value.to_f
200
- when :Boolean
201
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
- true
203
- else
204
- false
205
- end
206
- when :Object
207
- # generic object (usually a Hash), return directly
208
- value
209
- when /\AArray<(?<inner_type>.+)>\z/
210
- inner_type = Regexp.last_match[:inner_type]
211
- value.map { |v| _deserialize(inner_type, v) }
212
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
- k_type = Regexp.last_match[:k_type]
214
- v_type = Regexp.last_match[:v_type]
215
- {}.tap do |hash|
216
- value.each do |k, v|
217
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
- end
219
- end
220
- else # model
221
- # models (e.g. Pet) or oneOf
222
- klass = Patch.const_get(type)
223
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
224
- end
225
- end
226
-
227
- # Returns the string representation of the object
228
- # @return [String] String presentation of the object
229
- def to_s
230
- to_hash.to_s
231
- end
232
-
233
- # to_body is an alias to to_hash (backward compatibility)
234
- # @return [Hash] Returns the object in the form of hash
235
- def to_body
236
- to_hash
237
- end
238
-
239
- # Returns the object in the form of hash
240
- # @return [Hash] Returns the object in the form of hash
241
- def to_hash
242
- hash = {}
243
- self.class.attribute_map.each_pair do |attr, param|
244
- value = self.send(attr)
245
- if value.nil?
246
- is_nullable = self.class.openapi_nullable.include?(attr)
247
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
248
- end
249
-
250
- hash[param] = _to_hash(value)
251
- end
252
- hash
253
- end
254
-
255
- # Outputs non-array value in the form of hash
256
- # For object, use to_hash. Otherwise, just return the value
257
- # @param [Object] value Any valid value
258
- # @return [Hash] Returns the value in the form of hash
259
- def _to_hash(value)
260
- if value.is_a?(Array)
261
- value.compact.map { |v| _to_hash(v) }
262
- elsif value.is_a?(Hash)
263
- {}.tap do |hash|
264
- value.each { |k, v| hash[k] = _to_hash(v) }
265
- end
266
- elsif value.respond_to? :to_hash
267
- value.to_hash
268
- else
269
- value
270
- end
271
- end
272
- end
273
- end