patch_ruby 1.15.2 → 1.17.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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/Gemfile.lock +3 -2
  4. data/README.md +0 -27
  5. data/lib/patch_ruby/api/estimates_api.rb +28 -10
  6. data/lib/patch_ruby/api/orders_api.rb +10 -7
  7. data/lib/patch_ruby/api/projects_api.rb +4 -4
  8. data/lib/patch_ruby/api/technology_types_api.rb +3 -3
  9. data/lib/patch_ruby/api_client.rb +6 -6
  10. data/lib/patch_ruby/api_error.rb +2 -2
  11. data/lib/patch_ruby/configuration.rb +6 -6
  12. data/lib/patch_ruby/models/allocation.rb +2 -2
  13. data/lib/patch_ruby/models/create_bitcoin_estimate_request.rb +2 -2
  14. data/lib/patch_ruby/models/create_ethereum_estimate_request.rb +2 -2
  15. data/lib/patch_ruby/models/create_flight_estimate_request.rb +2 -2
  16. data/lib/patch_ruby/models/create_mass_estimate_request.rb +7 -7
  17. data/lib/patch_ruby/models/create_order_request.rb +7 -7
  18. data/lib/patch_ruby/models/create_shipping_estimate_request.rb +2 -2
  19. data/lib/patch_ruby/models/create_success_response.rb +3 -7
  20. data/lib/patch_ruby/models/create_vehicle_estimate_request.rb +2 -2
  21. data/lib/patch_ruby/models/error_response.rb +3 -7
  22. data/lib/patch_ruby/models/estimate.rb +5 -2
  23. data/lib/patch_ruby/models/estimate_list_response.rb +2 -2
  24. data/lib/patch_ruby/models/estimate_response.rb +2 -2
  25. data/lib/patch_ruby/models/highlight.rb +2 -2
  26. data/lib/patch_ruby/models/meta_index_object.rb +2 -2
  27. data/lib/patch_ruby/models/order.rb +10 -15
  28. data/lib/patch_ruby/models/order_list_response.rb +2 -2
  29. data/lib/patch_ruby/models/order_response.rb +2 -2
  30. data/lib/patch_ruby/models/parent_technology_type.rb +2 -2
  31. data/lib/patch_ruby/models/photo.rb +2 -2
  32. data/lib/patch_ruby/models/project.rb +9 -6
  33. data/lib/patch_ruby/models/project_list_response.rb +2 -2
  34. data/lib/patch_ruby/models/project_response.rb +2 -2
  35. data/lib/patch_ruby/models/sdg.rb +2 -2
  36. data/lib/patch_ruby/models/standard.rb +2 -2
  37. data/lib/patch_ruby/models/technology_type.rb +2 -2
  38. data/lib/patch_ruby/models/technology_type_list_response.rb +2 -2
  39. data/lib/patch_ruby/version.rb +3 -3
  40. data/lib/patch_ruby.rb +2 -7
  41. data/patch_ruby.gemspec +2 -2
  42. data/spec/api_client_spec.rb +4 -4
  43. data/spec/configuration_spec.rb +2 -2
  44. data/spec/integration/orders_spec.rb +1 -3
  45. data/spec/models/error_response_spec.rb +1 -1
  46. data/spec/spec_helper.rb +2 -2
  47. metadata +25 -50
  48. data/lib/patch_ruby/api/preferences_api.rb +0 -284
  49. data/lib/patch_ruby/models/create_preference_request.rb +0 -233
  50. data/lib/patch_ruby/models/preference.rb +0 -264
  51. data/lib/patch_ruby/models/preference_list_response.rb +0 -273
  52. data/lib/patch_ruby/models/preference_response.rb +0 -257
  53. data/spec/api/preferences_api_spec.rb +0 -82
  54. data/spec/factories/create_preference_requests.rb +0 -5
  55. data/spec/factories/preference_list_responses.rb +0 -8
  56. data/spec/factories/preference_responses.rb +0 -7
  57. data/spec/factories/preferences.rb +0 -7
  58. data/spec/integration/preferences_spec.rb +0 -32
  59. data/spec/models/create_preference_request_spec.rb +0 -47
  60. data/spec/models/preference_list_response_spec.rb +0 -64
  61. data/spec/models/preference_response_spec.rb +0 -58
  62. data/spec/models/preference_spec.rb +0 -58
@@ -1,284 +0,0 @@
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 'cgi'
14
-
15
- module Patch
16
- class PreferencesApi
17
- OPERATIONS = [
18
- :create_preference,
19
- :delete_preference,
20
- :retrieve_preference,
21
- :retrieve_preferences,
22
- ]
23
-
24
- attr_accessor :api_client
25
-
26
- def initialize(api_client = ApiClient.default)
27
- @api_client = api_client
28
- end
29
- # creates a project preference
30
- # Creates a project preference for the given organization. If you have a `preference` in place, all of your orders will be directed to the project the preference points to.
31
- # @param create_preference_request [CreatePreferenceRequest]
32
- # @param [Hash] opts the optional parameters
33
- # @return [PreferenceResponse]
34
- def create_preference(create_preference_request = {}, opts = {})
35
- _create_preference_request = Patch::CreatePreferenceRequest.new(create_preference_request)
36
- data, _status_code, _headers = create_preference_with_http_info(_create_preference_request, opts)
37
- data
38
- end
39
-
40
- # creates a project preference
41
- # Creates a project preference for the given organization. If you have a `preference` in place, all of your orders will be directed to the project the preference points to.
42
- # @param create_preference_request [CreatePreferenceRequest]
43
- # @param [Hash] opts the optional parameters
44
- # @return [Array<(PreferenceResponse, Integer, Hash)>] PreferenceResponse data, response status code and response headers
45
- def create_preference_with_http_info(create_preference_request, opts = {})
46
- if @api_client.config.debugging
47
- @api_client.config.logger.debug 'Calling API: PreferencesApi.create_preference ...'
48
- end
49
- # verify the required parameter 'create_preference_request' is set
50
- if @api_client.config.client_side_validation && create_preference_request.nil?
51
- fail ArgumentError, "Missing the required parameter 'create_preference_request' when calling PreferencesApi.create_preference"
52
- end
53
- # resource path
54
- local_var_path = '/v1/preferences'
55
-
56
- # query parameters
57
- query_params = opts[:query_params] || {}
58
-
59
- # header parameters
60
- header_params = opts[:header_params] || {}
61
- # HTTP header 'Accept' (if needed)
62
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
63
- # HTTP header 'Content-Type'
64
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
65
-
66
- # form parameters
67
- form_params = opts[:form_params] || {}
68
-
69
- # http body (model)
70
- post_body = opts[:debug_body] || @api_client.object_to_http_body(create_preference_request)
71
-
72
- # return_type
73
- return_type = opts[:debug_return_type] || 'PreferenceResponse'
74
-
75
- # auth_names
76
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
77
-
78
- new_options = opts.merge(
79
- :operation => :"PreferencesApi.create_preference",
80
- :header_params => header_params,
81
- :query_params => query_params,
82
- :form_params => form_params,
83
- :body => post_body,
84
- :auth_names => auth_names,
85
- :return_type => return_type
86
- )
87
-
88
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
89
- if @api_client.config.debugging
90
- @api_client.config.logger.debug "API called: PreferencesApi#create_preference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
91
- end
92
- return data, status_code, headers
93
- end
94
-
95
- # Deletes an organization's preference for a project
96
- # Deletes the given `preference`. Once a preference is deleted, it cannot be undone. If you want to restore your previous preference, create a new one.
97
- # @param id [String]
98
- # @param [Hash] opts the optional parameters
99
- # @return [PreferenceResponse]
100
- def delete_preference(id, opts = {})
101
-
102
- data, _status_code, _headers = delete_preference_with_http_info(id, opts)
103
- data
104
- end
105
-
106
- # Deletes an organization&#39;s preference for a project
107
- # Deletes the given &#x60;preference&#x60;. Once a preference is deleted, it cannot be undone. If you want to restore your previous preference, create a new one.
108
- # @param id [String]
109
- # @param [Hash] opts the optional parameters
110
- # @return [Array<(PreferenceResponse, Integer, Hash)>] PreferenceResponse data, response status code and response headers
111
- def delete_preference_with_http_info(id, opts = {})
112
- if @api_client.config.debugging
113
- @api_client.config.logger.debug 'Calling API: PreferencesApi.delete_preference ...'
114
- end
115
- # verify the required parameter 'id' is set
116
- if @api_client.config.client_side_validation && id.nil?
117
- fail ArgumentError, "Missing the required parameter 'id' when calling PreferencesApi.delete_preference"
118
- end
119
- # resource path
120
- local_var_path = '/v1/preferences/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
121
-
122
- # query parameters
123
- query_params = opts[:query_params] || {}
124
-
125
- # header parameters
126
- header_params = opts[:header_params] || {}
127
- # HTTP header 'Accept' (if needed)
128
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
129
-
130
- # form parameters
131
- form_params = opts[:form_params] || {}
132
-
133
- # http body (model)
134
- post_body = opts[:debug_body]
135
-
136
- # return_type
137
- return_type = opts[:debug_return_type] || 'PreferenceResponse'
138
-
139
- # auth_names
140
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
141
-
142
- new_options = opts.merge(
143
- :operation => :"PreferencesApi.delete_preference",
144
- :header_params => header_params,
145
- :query_params => query_params,
146
- :form_params => form_params,
147
- :body => post_body,
148
- :auth_names => auth_names,
149
- :return_type => return_type
150
- )
151
-
152
- data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
153
- if @api_client.config.debugging
154
- @api_client.config.logger.debug "API called: PreferencesApi#delete_preference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
155
- end
156
- return data, status_code, headers
157
- end
158
-
159
- # Retrieve the preference
160
- # Retrieve the preference and project of an organization. You can only retrieve preferences associated with your organization.
161
- # @param id [String]
162
- # @param [Hash] opts the optional parameters
163
- # @return [PreferenceResponse]
164
- def retrieve_preference(id, opts = {})
165
-
166
- data, _status_code, _headers = retrieve_preference_with_http_info(id, opts)
167
- data
168
- end
169
-
170
- # Retrieve the preference
171
- # Retrieve the preference and project of an organization. You can only retrieve preferences associated with your organization.
172
- # @param id [String]
173
- # @param [Hash] opts the optional parameters
174
- # @return [Array<(PreferenceResponse, Integer, Hash)>] PreferenceResponse data, response status code and response headers
175
- def retrieve_preference_with_http_info(id, opts = {})
176
- if @api_client.config.debugging
177
- @api_client.config.logger.debug 'Calling API: PreferencesApi.retrieve_preference ...'
178
- end
179
- # verify the required parameter 'id' is set
180
- if @api_client.config.client_side_validation && id.nil?
181
- fail ArgumentError, "Missing the required parameter 'id' when calling PreferencesApi.retrieve_preference"
182
- end
183
- # resource path
184
- local_var_path = '/v1/preferences/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
185
-
186
- # query parameters
187
- query_params = opts[:query_params] || {}
188
-
189
- # header parameters
190
- header_params = opts[:header_params] || {}
191
- # HTTP header 'Accept' (if needed)
192
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
193
-
194
- # form parameters
195
- form_params = opts[:form_params] || {}
196
-
197
- # http body (model)
198
- post_body = opts[:debug_body]
199
-
200
- # return_type
201
- return_type = opts[:debug_return_type] || 'PreferenceResponse'
202
-
203
- # auth_names
204
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
205
-
206
- new_options = opts.merge(
207
- :operation => :"PreferencesApi.retrieve_preference",
208
- :header_params => header_params,
209
- :query_params => query_params,
210
- :form_params => form_params,
211
- :body => post_body,
212
- :auth_names => auth_names,
213
- :return_type => return_type
214
- )
215
-
216
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
217
- if @api_client.config.debugging
218
- @api_client.config.logger.debug "API called: PreferencesApi#retrieve_preference\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
219
- end
220
- return data, status_code, headers
221
- end
222
-
223
- # Retrieves a list of preferences
224
- # Retrieves a list of preferences and associated projects of an organization. You can only retrieve preferences associated with your organization.
225
- # @param [Hash] opts the optional parameters
226
- # @option opts [Integer] :page
227
- # @return [PreferenceListResponse]
228
- def retrieve_preferences(opts = {})
229
-
230
- data, _status_code, _headers = retrieve_preferences_with_http_info(opts)
231
- data
232
- end
233
-
234
- # Retrieves a list of preferences
235
- # Retrieves a list of preferences and associated projects of an organization. You can only retrieve preferences associated with your organization.
236
- # @param [Hash] opts the optional parameters
237
- # @option opts [Integer] :page
238
- # @return [Array<(PreferenceListResponse, Integer, Hash)>] PreferenceListResponse data, response status code and response headers
239
- def retrieve_preferences_with_http_info(opts = {})
240
- if @api_client.config.debugging
241
- @api_client.config.logger.debug 'Calling API: PreferencesApi.retrieve_preferences ...'
242
- end
243
- # resource path
244
- local_var_path = '/v1/preferences'
245
-
246
- # query parameters
247
- query_params = opts[:query_params] || {}
248
- query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
249
-
250
- # header parameters
251
- header_params = opts[:header_params] || {}
252
- # HTTP header 'Accept' (if needed)
253
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
254
-
255
- # form parameters
256
- form_params = opts[:form_params] || {}
257
-
258
- # http body (model)
259
- post_body = opts[:debug_body]
260
-
261
- # return_type
262
- return_type = opts[:debug_return_type] || 'PreferenceListResponse'
263
-
264
- # auth_names
265
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
266
-
267
- new_options = opts.merge(
268
- :operation => :"PreferencesApi.retrieve_preferences",
269
- :header_params => header_params,
270
- :query_params => query_params,
271
- :form_params => form_params,
272
- :body => post_body,
273
- :auth_names => auth_names,
274
- :return_type => return_type
275
- )
276
-
277
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
278
- if @api_client.config.debugging
279
- @api_client.config.logger.debug "API called: PreferencesApi#retrieve_preferences\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
280
- end
281
- return data, status_code, headers
282
- end
283
- end
284
- end
@@ -1,233 +0,0 @@
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 CreatePreferenceRequest
18
- attr_accessor :project_id
19
-
20
- # Attribute mapping from ruby-style variable name to JSON key.
21
- def self.attribute_map
22
- {
23
- :'project_id' => :'project_id'
24
- }
25
- end
26
-
27
- # Returns all the JSON keys this model knows about
28
- def self.acceptable_attributes
29
- attribute_map.values
30
- end
31
-
32
- # Attribute type mapping.
33
- def self.openapi_types
34
- {
35
- :'project_id' => :'String'
36
- }
37
- end
38
-
39
- # List of attributes with nullable: true
40
- def self.openapi_nullable
41
- Set.new([
42
- ])
43
- end
44
-
45
-
46
- # Allows models with corresponding API classes to delegate API operations to those API classes
47
- # Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
48
- # Eg. Order.create_order delegates to OrdersApi.new.create_order
49
- def self.method_missing(message, *args, &block)
50
- if Object.const_defined?('Patch::CreatePreferenceRequestsApi::OPERATIONS') && Patch::CreatePreferenceRequestsApi::OPERATIONS.include?(message)
51
- Patch::CreatePreferenceRequestsApi.new.send(message, *args)
52
- else
53
- super
54
- end
55
- end
56
-
57
- # Initializes the object
58
- # @param [Hash] attributes Model attributes in the form of hash
59
- def initialize(attributes = {})
60
- if (!attributes.is_a?(Hash))
61
- fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::CreatePreferenceRequest` initialize method"
62
- end
63
-
64
- # check to see if the attribute exists and convert string to symbol for hash key
65
- attributes = attributes.each_with_object({}) { |(k, v), h|
66
- if (!self.class.attribute_map.key?(k.to_sym))
67
- fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::CreatePreferenceRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
- end
69
- h[k.to_sym] = v
70
- }
71
-
72
- if attributes.key?(:'project_id')
73
- self.project_id = attributes[:'project_id']
74
- end
75
- end
76
-
77
- # Show invalid properties with the reasons. Usually used together with valid?
78
- # @return Array for valid properties with the reasons
79
- def list_invalid_properties
80
- invalid_properties = Array.new
81
- if @project_id.nil?
82
- invalid_properties.push('invalid value for "project_id", project_id cannot be nil.')
83
- end
84
-
85
- invalid_properties
86
- end
87
-
88
- # Check to see if the all the properties in the model are valid
89
- # @return true if the model is valid
90
- def valid?
91
- return false if @project_id.nil?
92
- true
93
- end
94
-
95
- # Checks equality by comparing each attribute.
96
- # @param [Object] Object to be compared
97
- def ==(o)
98
- return true if self.equal?(o)
99
- self.class == o.class &&
100
- project_id == o.project_id
101
- end
102
-
103
- # @see the `==` method
104
- # @param [Object] Object to be compared
105
- def eql?(o)
106
- self == o
107
- end
108
-
109
- # Calculates hash code according to all attributes.
110
- # @return [Integer] Hash code
111
- def hash
112
- [project_id].hash
113
- end
114
-
115
- # Builds the object from hash
116
- # @param [Hash] attributes Model attributes in the form of hash
117
- # @return [Object] Returns the model itself
118
- def self.build_from_hash(attributes)
119
- new.build_from_hash(attributes)
120
- end
121
-
122
- # Builds the object from hash
123
- # @param [Hash] attributes Model attributes in the form of hash
124
- # @return [Object] Returns the model itself
125
- def build_from_hash(attributes)
126
- return nil unless attributes.is_a?(Hash)
127
- self.class.openapi_types.each_pair do |key, type|
128
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
129
- self.send("#{key}=", nil)
130
- elsif type =~ /\AArray<(.*)>/i
131
- # check to ensure the input is an array given that the attribute
132
- # is documented as an array but the input is not
133
- if attributes[self.class.attribute_map[key]].is_a?(Array)
134
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
135
- end
136
- elsif !attributes[self.class.attribute_map[key]].nil?
137
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
138
- end
139
- end
140
-
141
- self
142
- end
143
-
144
- # Deserializes the data based on type
145
- # @param string type Data type
146
- # @param string value Value to be deserialized
147
- # @return [Object] Deserialized data
148
- def _deserialize(type, value)
149
- case type.to_sym
150
- when :Time
151
- Time.parse(value)
152
- when :Date
153
- Date.parse(value)
154
- when :String
155
- value.to_s
156
- when :Integer
157
- value.to_i
158
- when :Float
159
- value.to_f
160
- when :Boolean
161
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
- true
163
- else
164
- false
165
- end
166
- when :Object
167
- # generic object (usually a Hash), return directly
168
- value
169
- when /\AArray<(?<inner_type>.+)>\z/
170
- inner_type = Regexp.last_match[:inner_type]
171
- value.map { |v| _deserialize(inner_type, v) }
172
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
- k_type = Regexp.last_match[:k_type]
174
- v_type = Regexp.last_match[:v_type]
175
- {}.tap do |hash|
176
- value.each do |k, v|
177
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
- end
179
- end
180
- else # model
181
- # models (e.g. Pet) or oneOf
182
- klass = Patch.const_get(type)
183
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
184
- end
185
- end
186
-
187
- # Returns the string representation of the object
188
- # @return [String] String presentation of the object
189
- def to_s
190
- to_hash.to_s
191
- end
192
-
193
- # to_body is an alias to to_hash (backward compatibility)
194
- # @return [Hash] Returns the object in the form of hash
195
- def to_body
196
- to_hash
197
- end
198
-
199
- # Returns the object in the form of hash
200
- # @return [Hash] Returns the object in the form of hash
201
- def to_hash
202
- hash = {}
203
- self.class.attribute_map.each_pair do |attr, param|
204
- value = self.send(attr)
205
- if value.nil?
206
- is_nullable = self.class.openapi_nullable.include?(attr)
207
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
- end
209
-
210
- hash[param] = _to_hash(value)
211
- end
212
- hash
213
- end
214
-
215
- # Outputs non-array value in the form of hash
216
- # For object, use to_hash. Otherwise, just return the value
217
- # @param [Object] value Any valid value
218
- # @return [Hash] Returns the value in the form of hash
219
- def _to_hash(value)
220
- if value.is_a?(Array)
221
- value.compact.map { |v| _to_hash(v) }
222
- elsif value.is_a?(Hash)
223
- {}.tap do |hash|
224
- value.each { |k, v| hash[k] = _to_hash(v) }
225
- end
226
- elsif value.respond_to? :to_hash
227
- value.to_hash
228
- else
229
- value
230
- end
231
- end
232
- end
233
- end