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,687 +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 'cgi'
14
-
15
- module Patch
16
- class EstimatesApi
17
- OPERATIONS = [
18
- :create_air_shipping_estimate,
19
- :create_bitcoin_estimate,
20
- :create_flight_estimate,
21
- :create_mass_estimate,
22
- :create_rail_shipping_estimate,
23
- :create_road_shipping_estimate,
24
- :create_sea_shipping_estimate,
25
- :retrieve_estimate,
26
- :retrieve_estimates,
27
- ]
28
-
29
- attr_accessor :api_client
30
-
31
- def initialize(api_client = ApiClient.default)
32
- @api_client = api_client
33
- end
34
- # Creates a GLEC air shipping estimate given freight mass and logistics
35
- # Creates a GLEC air shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
36
- # @param create_air_shipping_estimate_request [CreateAirShippingEstimateRequest]
37
- # @param [Hash] opts the optional parameters
38
- # @option opts [Integer] :patch_version
39
- # @return [EstimateResponse]
40
- def create_air_shipping_estimate(create_air_shipping_estimate_request = {}, opts = {})
41
- _create_air_shipping_estimate_request = Patch::CreateAirShippingEstimateRequest.new(create_air_shipping_estimate_request)
42
- data, _status_code, _headers = create_air_shipping_estimate_with_http_info(_create_air_shipping_estimate_request, opts)
43
- data
44
- end
45
-
46
- # Creates a GLEC air shipping estimate given freight mass and logistics
47
- # Creates a GLEC air shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
48
- # @param create_air_shipping_estimate_request [CreateAirShippingEstimateRequest]
49
- # @param [Hash] opts the optional parameters
50
- # @option opts [Integer] :patch_version
51
- # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
52
- def create_air_shipping_estimate_with_http_info(create_air_shipping_estimate_request, opts = {})
53
- if @api_client.config.debugging
54
- @api_client.config.logger.debug 'Calling API: EstimatesApi.create_air_shipping_estimate ...'
55
- end
56
- # verify the required parameter 'create_air_shipping_estimate_request' is set
57
- if @api_client.config.client_side_validation && create_air_shipping_estimate_request.nil?
58
- fail ArgumentError, "Missing the required parameter 'create_air_shipping_estimate_request' when calling EstimatesApi.create_air_shipping_estimate"
59
- end
60
- # resource path
61
- local_var_path = '/v1/estimates/shipping/air'
62
-
63
- # query parameters
64
- query_params = opts[:query_params] || {}
65
-
66
- # header parameters
67
- header_params = opts[:header_params] || {}
68
-
69
- # HTTP header 'Accept' (if needed)
70
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
71
- # HTTP header 'Content-Type'
72
- content_type = @api_client.select_header_content_type(['application/json'])
73
- if !content_type.nil?
74
- header_params['Content-Type'] = content_type
75
- end
76
- header_params['Patch-Version'] = 2
77
- header_params[:'Patch-Version'] = opts[:'patch_version'] if !opts[:'patch_version'].nil?
78
-
79
- # form parameters
80
- form_params = opts[:form_params] || {}
81
-
82
- # http body (model)
83
- post_body = opts[:debug_body] || @api_client.object_to_http_body(create_air_shipping_estimate_request)
84
-
85
- # return_type
86
- return_type = opts[:debug_return_type] || 'EstimateResponse'
87
-
88
- # auth_names
89
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
90
-
91
- new_options = opts.merge(
92
- :operation => :"EstimatesApi.create_air_shipping_estimate",
93
- :header_params => header_params,
94
- :query_params => query_params,
95
- :form_params => form_params,
96
- :body => post_body,
97
- :auth_names => auth_names,
98
- :return_type => return_type
99
- )
100
-
101
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
102
- if @api_client.config.debugging
103
- @api_client.config.logger.debug "API called: EstimatesApi#create_air_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
104
- end
105
- return data, status_code, headers
106
- end
107
-
108
- # Create a bitcoin estimate given a timestamp and transaction value
109
- # Creates a bitcoin estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
110
- # @param create_bitcoin_estimate_request [CreateBitcoinEstimateRequest]
111
- # @param [Hash] opts the optional parameters
112
- # @option opts [Integer] :patch_version
113
- # @return [EstimateResponse]
114
- def create_bitcoin_estimate(create_bitcoin_estimate_request = {}, opts = {})
115
- _create_bitcoin_estimate_request = Patch::CreateBitcoinEstimateRequest.new(create_bitcoin_estimate_request)
116
- data, _status_code, _headers = create_bitcoin_estimate_with_http_info(_create_bitcoin_estimate_request, opts)
117
- data
118
- end
119
-
120
- # Create a bitcoin estimate given a timestamp and transaction value
121
- # Creates a bitcoin estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
122
- # @param create_bitcoin_estimate_request [CreateBitcoinEstimateRequest]
123
- # @param [Hash] opts the optional parameters
124
- # @option opts [Integer] :patch_version
125
- # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
126
- def create_bitcoin_estimate_with_http_info(create_bitcoin_estimate_request, opts = {})
127
- if @api_client.config.debugging
128
- @api_client.config.logger.debug 'Calling API: EstimatesApi.create_bitcoin_estimate ...'
129
- end
130
- # verify the required parameter 'create_bitcoin_estimate_request' is set
131
- if @api_client.config.client_side_validation && create_bitcoin_estimate_request.nil?
132
- fail ArgumentError, "Missing the required parameter 'create_bitcoin_estimate_request' when calling EstimatesApi.create_bitcoin_estimate"
133
- end
134
- # resource path
135
- local_var_path = '/v1/estimates/crypto/btc'
136
-
137
- # query parameters
138
- query_params = opts[:query_params] || {}
139
-
140
- # header parameters
141
- header_params = opts[:header_params] || {}
142
-
143
- # HTTP header 'Accept' (if needed)
144
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
145
- # HTTP header 'Content-Type'
146
- content_type = @api_client.select_header_content_type(['application/json'])
147
- if !content_type.nil?
148
- header_params['Content-Type'] = content_type
149
- end
150
- header_params['Patch-Version'] = 2
151
- header_params[:'Patch-Version'] = opts[:'patch_version'] if !opts[:'patch_version'].nil?
152
-
153
- # form parameters
154
- form_params = opts[:form_params] || {}
155
-
156
- # http body (model)
157
- post_body = opts[:debug_body] || @api_client.object_to_http_body(create_bitcoin_estimate_request)
158
-
159
- # return_type
160
- return_type = opts[:debug_return_type] || 'EstimateResponse'
161
-
162
- # auth_names
163
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
164
-
165
- new_options = opts.merge(
166
- :operation => :"EstimatesApi.create_bitcoin_estimate",
167
- :header_params => header_params,
168
- :query_params => query_params,
169
- :form_params => form_params,
170
- :body => post_body,
171
- :auth_names => auth_names,
172
- :return_type => return_type
173
- )
174
-
175
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
176
- if @api_client.config.debugging
177
- @api_client.config.logger.debug "API called: EstimatesApi#create_bitcoin_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
178
- end
179
- return data, status_code, headers
180
- end
181
-
182
- # Create a flight estimate given the distance traveled in meters
183
- # Creates a flight estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
184
- # @param create_flight_estimate_request [CreateFlightEstimateRequest]
185
- # @param [Hash] opts the optional parameters
186
- # @option opts [Integer] :patch_version
187
- # @return [EstimateResponse]
188
- def create_flight_estimate(create_flight_estimate_request = {}, opts = {})
189
- _create_flight_estimate_request = Patch::CreateFlightEstimateRequest.new(create_flight_estimate_request)
190
- data, _status_code, _headers = create_flight_estimate_with_http_info(_create_flight_estimate_request, opts)
191
- data
192
- end
193
-
194
- # Create a flight estimate given the distance traveled in meters
195
- # Creates a flight estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
196
- # @param create_flight_estimate_request [CreateFlightEstimateRequest]
197
- # @param [Hash] opts the optional parameters
198
- # @option opts [Integer] :patch_version
199
- # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
200
- def create_flight_estimate_with_http_info(create_flight_estimate_request, opts = {})
201
- if @api_client.config.debugging
202
- @api_client.config.logger.debug 'Calling API: EstimatesApi.create_flight_estimate ...'
203
- end
204
- # verify the required parameter 'create_flight_estimate_request' is set
205
- if @api_client.config.client_side_validation && create_flight_estimate_request.nil?
206
- fail ArgumentError, "Missing the required parameter 'create_flight_estimate_request' when calling EstimatesApi.create_flight_estimate"
207
- end
208
- # resource path
209
- local_var_path = '/v1/estimates/flight'
210
-
211
- # query parameters
212
- query_params = opts[:query_params] || {}
213
-
214
- # header parameters
215
- header_params = opts[:header_params] || {}
216
-
217
- # HTTP header 'Accept' (if needed)
218
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
219
- # HTTP header 'Content-Type'
220
- content_type = @api_client.select_header_content_type(['application/json'])
221
- if !content_type.nil?
222
- header_params['Content-Type'] = content_type
223
- end
224
- header_params['Patch-Version'] = 2
225
- header_params[:'Patch-Version'] = opts[:'patch_version'] if !opts[:'patch_version'].nil?
226
-
227
- # form parameters
228
- form_params = opts[:form_params] || {}
229
-
230
- # http body (model)
231
- post_body = opts[:debug_body] || @api_client.object_to_http_body(create_flight_estimate_request)
232
-
233
- # return_type
234
- return_type = opts[:debug_return_type] || 'EstimateResponse'
235
-
236
- # auth_names
237
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
238
-
239
- new_options = opts.merge(
240
- :operation => :"EstimatesApi.create_flight_estimate",
241
- :header_params => header_params,
242
- :query_params => query_params,
243
- :form_params => form_params,
244
- :body => post_body,
245
- :auth_names => auth_names,
246
- :return_type => return_type
247
- )
248
-
249
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
250
- if @api_client.config.debugging
251
- @api_client.config.logger.debug "API called: EstimatesApi#create_flight_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
252
- end
253
- return data, status_code, headers
254
- end
255
-
256
- # Create an estimate based on mass of CO2
257
- # Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate.
258
- # @param create_mass_estimate_request [CreateMassEstimateRequest]
259
- # @param [Hash] opts the optional parameters
260
- # @option opts [Integer] :patch_version
261
- # @return [EstimateResponse]
262
- def create_mass_estimate(create_mass_estimate_request = {}, opts = {})
263
- _create_mass_estimate_request = Patch::CreateMassEstimateRequest.new(create_mass_estimate_request)
264
- data, _status_code, _headers = create_mass_estimate_with_http_info(_create_mass_estimate_request, opts)
265
- data
266
- end
267
-
268
- # Create an estimate based on mass of CO2
269
- # Creates an estimate for the mass of CO2 to be compensated. An order in the `draft` state will also be created, linked to the estimate.
270
- # @param create_mass_estimate_request [CreateMassEstimateRequest]
271
- # @param [Hash] opts the optional parameters
272
- # @option opts [Integer] :patch_version
273
- # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
274
- def create_mass_estimate_with_http_info(create_mass_estimate_request, opts = {})
275
- if @api_client.config.debugging
276
- @api_client.config.logger.debug 'Calling API: EstimatesApi.create_mass_estimate ...'
277
- end
278
- # verify the required parameter 'create_mass_estimate_request' is set
279
- if @api_client.config.client_side_validation && create_mass_estimate_request.nil?
280
- fail ArgumentError, "Missing the required parameter 'create_mass_estimate_request' when calling EstimatesApi.create_mass_estimate"
281
- end
282
- # resource path
283
- local_var_path = '/v1/estimates/mass'
284
-
285
- # query parameters
286
- query_params = opts[:query_params] || {}
287
-
288
- # header parameters
289
- header_params = opts[:header_params] || {}
290
-
291
- # HTTP header 'Accept' (if needed)
292
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
293
- # HTTP header 'Content-Type'
294
- content_type = @api_client.select_header_content_type(['application/json'])
295
- if !content_type.nil?
296
- header_params['Content-Type'] = content_type
297
- end
298
- header_params['Patch-Version'] = 2
299
- header_params[:'Patch-Version'] = opts[:'patch_version'] if !opts[:'patch_version'].nil?
300
-
301
- # form parameters
302
- form_params = opts[:form_params] || {}
303
-
304
- # http body (model)
305
- post_body = opts[:debug_body] || @api_client.object_to_http_body(create_mass_estimate_request)
306
-
307
- # return_type
308
- return_type = opts[:debug_return_type] || 'EstimateResponse'
309
-
310
- # auth_names
311
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
312
-
313
- new_options = opts.merge(
314
- :operation => :"EstimatesApi.create_mass_estimate",
315
- :header_params => header_params,
316
- :query_params => query_params,
317
- :form_params => form_params,
318
- :body => post_body,
319
- :auth_names => auth_names,
320
- :return_type => return_type
321
- )
322
-
323
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
324
- if @api_client.config.debugging
325
- @api_client.config.logger.debug "API called: EstimatesApi#create_mass_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
326
- end
327
- return data, status_code, headers
328
- end
329
-
330
- # Creates a GLEC rail shipping estimate given freight mass and logistics
331
- # Creates a GLEC rail shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
332
- # @param create_rail_shipping_estimate_request [CreateRailShippingEstimateRequest]
333
- # @param [Hash] opts the optional parameters
334
- # @option opts [Integer] :patch_version
335
- # @return [EstimateResponse]
336
- def create_rail_shipping_estimate(create_rail_shipping_estimate_request = {}, opts = {})
337
- _create_rail_shipping_estimate_request = Patch::CreateRailShippingEstimateRequest.new(create_rail_shipping_estimate_request)
338
- data, _status_code, _headers = create_rail_shipping_estimate_with_http_info(_create_rail_shipping_estimate_request, opts)
339
- data
340
- end
341
-
342
- # Creates a GLEC rail shipping estimate given freight mass and logistics
343
- # Creates a GLEC rail shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
344
- # @param create_rail_shipping_estimate_request [CreateRailShippingEstimateRequest]
345
- # @param [Hash] opts the optional parameters
346
- # @option opts [Integer] :patch_version
347
- # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
348
- def create_rail_shipping_estimate_with_http_info(create_rail_shipping_estimate_request, opts = {})
349
- if @api_client.config.debugging
350
- @api_client.config.logger.debug 'Calling API: EstimatesApi.create_rail_shipping_estimate ...'
351
- end
352
- # verify the required parameter 'create_rail_shipping_estimate_request' is set
353
- if @api_client.config.client_side_validation && create_rail_shipping_estimate_request.nil?
354
- fail ArgumentError, "Missing the required parameter 'create_rail_shipping_estimate_request' when calling EstimatesApi.create_rail_shipping_estimate"
355
- end
356
- # resource path
357
- local_var_path = '/v1/estimates/shipping/rail'
358
-
359
- # query parameters
360
- query_params = opts[:query_params] || {}
361
-
362
- # header parameters
363
- header_params = opts[:header_params] || {}
364
-
365
- # HTTP header 'Accept' (if needed)
366
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
367
- # HTTP header 'Content-Type'
368
- content_type = @api_client.select_header_content_type(['application/json'])
369
- if !content_type.nil?
370
- header_params['Content-Type'] = content_type
371
- end
372
- header_params['Patch-Version'] = 2
373
- header_params[:'Patch-Version'] = opts[:'patch_version'] if !opts[:'patch_version'].nil?
374
-
375
- # form parameters
376
- form_params = opts[:form_params] || {}
377
-
378
- # http body (model)
379
- post_body = opts[:debug_body] || @api_client.object_to_http_body(create_rail_shipping_estimate_request)
380
-
381
- # return_type
382
- return_type = opts[:debug_return_type] || 'EstimateResponse'
383
-
384
- # auth_names
385
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
386
-
387
- new_options = opts.merge(
388
- :operation => :"EstimatesApi.create_rail_shipping_estimate",
389
- :header_params => header_params,
390
- :query_params => query_params,
391
- :form_params => form_params,
392
- :body => post_body,
393
- :auth_names => auth_names,
394
- :return_type => return_type
395
- )
396
-
397
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
398
- if @api_client.config.debugging
399
- @api_client.config.logger.debug "API called: EstimatesApi#create_rail_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
400
- end
401
- return data, status_code, headers
402
- end
403
-
404
- # Creates a GLEC road shipping estimate given freight mass and logistics
405
- # Creates a GLEC road shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
406
- # @param create_road_shipping_estimate_request [CreateRoadShippingEstimateRequest]
407
- # @param [Hash] opts the optional parameters
408
- # @option opts [Integer] :patch_version
409
- # @return [EstimateResponse]
410
- def create_road_shipping_estimate(create_road_shipping_estimate_request = {}, opts = {})
411
- _create_road_shipping_estimate_request = Patch::CreateRoadShippingEstimateRequest.new(create_road_shipping_estimate_request)
412
- data, _status_code, _headers = create_road_shipping_estimate_with_http_info(_create_road_shipping_estimate_request, opts)
413
- data
414
- end
415
-
416
- # Creates a GLEC road shipping estimate given freight mass and logistics
417
- # Creates a GLEC road shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
418
- # @param create_road_shipping_estimate_request [CreateRoadShippingEstimateRequest]
419
- # @param [Hash] opts the optional parameters
420
- # @option opts [Integer] :patch_version
421
- # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
422
- def create_road_shipping_estimate_with_http_info(create_road_shipping_estimate_request, opts = {})
423
- if @api_client.config.debugging
424
- @api_client.config.logger.debug 'Calling API: EstimatesApi.create_road_shipping_estimate ...'
425
- end
426
- # verify the required parameter 'create_road_shipping_estimate_request' is set
427
- if @api_client.config.client_side_validation && create_road_shipping_estimate_request.nil?
428
- fail ArgumentError, "Missing the required parameter 'create_road_shipping_estimate_request' when calling EstimatesApi.create_road_shipping_estimate"
429
- end
430
- # resource path
431
- local_var_path = '/v1/estimates/shipping/road'
432
-
433
- # query parameters
434
- query_params = opts[:query_params] || {}
435
-
436
- # header parameters
437
- header_params = opts[:header_params] || {}
438
-
439
- # HTTP header 'Accept' (if needed)
440
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
441
- # HTTP header 'Content-Type'
442
- content_type = @api_client.select_header_content_type(['application/json'])
443
- if !content_type.nil?
444
- header_params['Content-Type'] = content_type
445
- end
446
- header_params['Patch-Version'] = 2
447
- header_params[:'Patch-Version'] = opts[:'patch_version'] if !opts[:'patch_version'].nil?
448
-
449
- # form parameters
450
- form_params = opts[:form_params] || {}
451
-
452
- # http body (model)
453
- post_body = opts[:debug_body] || @api_client.object_to_http_body(create_road_shipping_estimate_request)
454
-
455
- # return_type
456
- return_type = opts[:debug_return_type] || 'EstimateResponse'
457
-
458
- # auth_names
459
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
460
-
461
- new_options = opts.merge(
462
- :operation => :"EstimatesApi.create_road_shipping_estimate",
463
- :header_params => header_params,
464
- :query_params => query_params,
465
- :form_params => form_params,
466
- :body => post_body,
467
- :auth_names => auth_names,
468
- :return_type => return_type
469
- )
470
-
471
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
472
- if @api_client.config.debugging
473
- @api_client.config.logger.debug "API called: EstimatesApi#create_road_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
474
- end
475
- return data, status_code, headers
476
- end
477
-
478
- # Creates a GLEC sea shipping estimate given freight mass and logistics
479
- # Creates a GLEC sea shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
480
- # @param create_sea_shipping_estimate_request [CreateSeaShippingEstimateRequest]
481
- # @param [Hash] opts the optional parameters
482
- # @option opts [Integer] :patch_version
483
- # @return [EstimateResponse]
484
- def create_sea_shipping_estimate(create_sea_shipping_estimate_request = {}, opts = {})
485
- _create_sea_shipping_estimate_request = Patch::CreateSeaShippingEstimateRequest.new(create_sea_shipping_estimate_request)
486
- data, _status_code, _headers = create_sea_shipping_estimate_with_http_info(_create_sea_shipping_estimate_request, opts)
487
- data
488
- end
489
-
490
- # Creates a GLEC sea shipping estimate given freight mass and logistics
491
- # Creates a GLEC sea shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters, linked to the estimate.
492
- # @param create_sea_shipping_estimate_request [CreateSeaShippingEstimateRequest]
493
- # @param [Hash] opts the optional parameters
494
- # @option opts [Integer] :patch_version
495
- # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
496
- def create_sea_shipping_estimate_with_http_info(create_sea_shipping_estimate_request, opts = {})
497
- if @api_client.config.debugging
498
- @api_client.config.logger.debug 'Calling API: EstimatesApi.create_sea_shipping_estimate ...'
499
- end
500
- # verify the required parameter 'create_sea_shipping_estimate_request' is set
501
- if @api_client.config.client_side_validation && create_sea_shipping_estimate_request.nil?
502
- fail ArgumentError, "Missing the required parameter 'create_sea_shipping_estimate_request' when calling EstimatesApi.create_sea_shipping_estimate"
503
- end
504
- # resource path
505
- local_var_path = '/v1/estimates/shipping/sea'
506
-
507
- # query parameters
508
- query_params = opts[:query_params] || {}
509
-
510
- # header parameters
511
- header_params = opts[:header_params] || {}
512
-
513
- # HTTP header 'Accept' (if needed)
514
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
515
- # HTTP header 'Content-Type'
516
- content_type = @api_client.select_header_content_type(['application/json'])
517
- if !content_type.nil?
518
- header_params['Content-Type'] = content_type
519
- end
520
- header_params['Patch-Version'] = 2
521
- header_params[:'Patch-Version'] = opts[:'patch_version'] if !opts[:'patch_version'].nil?
522
-
523
- # form parameters
524
- form_params = opts[:form_params] || {}
525
-
526
- # http body (model)
527
- post_body = opts[:debug_body] || @api_client.object_to_http_body(create_sea_shipping_estimate_request)
528
-
529
- # return_type
530
- return_type = opts[:debug_return_type] || 'EstimateResponse'
531
-
532
- # auth_names
533
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
534
-
535
- new_options = opts.merge(
536
- :operation => :"EstimatesApi.create_sea_shipping_estimate",
537
- :header_params => header_params,
538
- :query_params => query_params,
539
- :form_params => form_params,
540
- :body => post_body,
541
- :auth_names => auth_names,
542
- :return_type => return_type
543
- )
544
-
545
- data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
546
- if @api_client.config.debugging
547
- @api_client.config.logger.debug "API called: EstimatesApi#create_sea_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
548
- end
549
- return data, status_code, headers
550
- end
551
-
552
- # Retrieves an estimate
553
- # Retrieves a given estimate and its associated order. You can only retrieve estimates associated with the organization you are querying for.
554
- # @param id [String]
555
- # @param [Hash] opts the optional parameters
556
- # @option opts [Integer] :patch_version
557
- # @return [EstimateResponse]
558
- def retrieve_estimate(id, opts = {})
559
-
560
- data, _status_code, _headers = retrieve_estimate_with_http_info(id, opts)
561
- data
562
- end
563
-
564
- # Retrieves an estimate
565
- # Retrieves a given estimate and its associated order. You can only retrieve estimates associated with the organization you are querying for.
566
- # @param id [String]
567
- # @param [Hash] opts the optional parameters
568
- # @option opts [Integer] :patch_version
569
- # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
570
- def retrieve_estimate_with_http_info(id, opts = {})
571
- if @api_client.config.debugging
572
- @api_client.config.logger.debug 'Calling API: EstimatesApi.retrieve_estimate ...'
573
- end
574
- # verify the required parameter 'id' is set
575
- if @api_client.config.client_side_validation && id.nil?
576
- fail ArgumentError, "Missing the required parameter 'id' when calling EstimatesApi.retrieve_estimate"
577
- end
578
- # resource path
579
- local_var_path = '/v1/estimates/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
580
-
581
- # query parameters
582
- query_params = opts[:query_params] || {}
583
-
584
- # header parameters
585
- header_params = opts[:header_params] || {}
586
-
587
- # HTTP header 'Accept' (if needed)
588
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
589
- header_params['Patch-Version'] = 2
590
- header_params[:'Patch-Version'] = opts[:'patch_version'] if !opts[:'patch_version'].nil?
591
-
592
- # form parameters
593
- form_params = opts[:form_params] || {}
594
-
595
- # http body (model)
596
- post_body = opts[:debug_body]
597
-
598
- # return_type
599
- return_type = opts[:debug_return_type] || 'EstimateResponse'
600
-
601
- # auth_names
602
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
603
-
604
- new_options = opts.merge(
605
- :operation => :"EstimatesApi.retrieve_estimate",
606
- :header_params => header_params,
607
- :query_params => query_params,
608
- :form_params => form_params,
609
- :body => post_body,
610
- :auth_names => auth_names,
611
- :return_type => return_type
612
- )
613
-
614
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
615
- if @api_client.config.debugging
616
- @api_client.config.logger.debug "API called: EstimatesApi#retrieve_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
617
- end
618
- return data, status_code, headers
619
- end
620
-
621
- # Retrieves a list of estimates
622
- # Retrieves a list of estimates and their associated orders. You can only retrieve estimates associated with the organization you are querying for.
623
- # @param [Hash] opts the optional parameters
624
- # @option opts [Integer] :page
625
- # @option opts [Integer] :patch_version
626
- # @return [EstimateListResponse]
627
- def retrieve_estimates(opts = {})
628
-
629
- data, _status_code, _headers = retrieve_estimates_with_http_info(opts)
630
- data
631
- end
632
-
633
- # Retrieves a list of estimates
634
- # Retrieves a list of estimates and their associated orders. You can only retrieve estimates associated with the organization you are querying for.
635
- # @param [Hash] opts the optional parameters
636
- # @option opts [Integer] :page
637
- # @option opts [Integer] :patch_version
638
- # @return [Array<(EstimateListResponse, Integer, Hash)>] EstimateListResponse data, response status code and response headers
639
- def retrieve_estimates_with_http_info(opts = {})
640
- if @api_client.config.debugging
641
- @api_client.config.logger.debug 'Calling API: EstimatesApi.retrieve_estimates ...'
642
- end
643
- # resource path
644
- local_var_path = '/v1/estimates'
645
-
646
- # query parameters
647
- query_params = opts[:query_params] || {}
648
- query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
649
-
650
- # header parameters
651
- header_params = opts[:header_params] || {}
652
-
653
- # HTTP header 'Accept' (if needed)
654
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
655
- header_params['Patch-Version'] = 2
656
- header_params[:'Patch-Version'] = opts[:'patch_version'] if !opts[:'patch_version'].nil?
657
-
658
- # form parameters
659
- form_params = opts[:form_params] || {}
660
-
661
- # http body (model)
662
- post_body = opts[:debug_body]
663
-
664
- # return_type
665
- return_type = opts[:debug_return_type] || 'EstimateListResponse'
666
-
667
- # auth_names
668
- auth_names = opts[:debug_auth_names] || ['bearer_auth']
669
-
670
- new_options = opts.merge(
671
- :operation => :"EstimatesApi.retrieve_estimates",
672
- :header_params => header_params,
673
- :query_params => query_params,
674
- :form_params => form_params,
675
- :body => post_body,
676
- :auth_names => auth_names,
677
- :return_type => return_type
678
- )
679
-
680
- data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
681
- if @api_client.config.debugging
682
- @api_client.config.logger.debug "API called: EstimatesApi#retrieve_estimates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
683
- end
684
- return data, status_code, headers
685
- end
686
- end
687
- end