patch_ruby 1.23.0 → 1.24.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/Gemfile.lock +1 -1
- data/README.md +11 -11
- data/lib/patch_ruby/api/estimates_api.rb +357 -7
- data/lib/patch_ruby/api/orders_api.rb +36 -36
- data/lib/patch_ruby/api/projects_api.rb +2 -2
- data/lib/patch_ruby/api_client.rb +1 -1
- data/lib/patch_ruby/models/create_air_shipping_estimate_request.rb +374 -0
- data/lib/patch_ruby/models/{v1_orders_issued_to.rb → create_ecommerce_estimate_request.rb} +154 -20
- data/lib/patch_ruby/models/create_order_request.rb +3 -4
- data/lib/patch_ruby/models/create_rail_shipping_estimate_request.rb +404 -0
- data/lib/patch_ruby/models/create_road_shipping_estimate_request.rb +507 -0
- data/lib/patch_ruby/models/create_sea_shipping_estimate_request.rb +461 -0
- data/lib/patch_ruby/models/order.rb +7 -3
- data/lib/patch_ruby/models/{issued_to.rb → order_issued_to.rb} +7 -7
- data/lib/patch_ruby/models/place_order_request.rb +1 -2
- data/lib/patch_ruby/models/project.rb +1 -1
- data/lib/patch_ruby/version.rb +1 -1
- data/lib/patch_ruby.rb +6 -2
- data/spec/integration/estimates_spec.rb +165 -1
- data/spec/integration/orders_spec.rb +3 -3
- data/spec/integration/projects_spec.rb +2 -2
- data/spec/models/create_order_request_spec.rb +1 -1
- metadata +31 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b23fba84f1274a67e893894072fecdbce7dca1d06032e8e633a6a41aad29c1ef
|
4
|
+
data.tar.gz: 19b0e1d44b7e07b1b8a01c2eb7167e79a4bdaabc2ed6fce1a4494e1ea509a981
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2acf29fa87be15b021490c6bea19c8342f870636dff4ef5afd95b6be64e7885f6ee19e8aea490f50c40e4f09e2dea0706f272f207e4219ecc891ea4ca7c42c49
|
7
|
+
data.tar.gz: '079afc3add925e55cc64f9752e6f0ebf871ee6b8e7cd94c39b0c4e07eafc5a507c72b3b6bfaa4166eb3fcbc1a389317b26ea9538cfe676c0a1be9d96ae8871f3'
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [1.24.2] - 2022-08-10
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Adds `Patch::Estimate.create_ecommerce_estimate` method
|
13
|
+
|
14
|
+
## [1.24.0] - 2022-07-22
|
15
|
+
|
16
|
+
### Added
|
17
|
+
|
18
|
+
- Adds `Patch::Estimate.create_air_shipping_estimate` method
|
19
|
+
- Adds `Patch::Estimate.create_rail_shipping_estimate` method
|
20
|
+
- Adds `Patch::Estimate.create_road_shipping_estimate` method
|
21
|
+
- Adds `Patch::Estimate.create_sea_shipping_estimate` method
|
22
|
+
|
8
23
|
## [1.23.0] - 2022-06-03
|
9
24
|
|
10
25
|
### Added
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -127,16 +127,6 @@ Patch::Estimate.create_mass_estimate(mass_g: mass)
|
|
127
127
|
distance_m = 1_000_000 # Pass in the distance traveled in meters
|
128
128
|
Patch::Estimate.create_flight_estimate(distance_m: distance_m)
|
129
129
|
|
130
|
-
# Create a shipping estimate
|
131
|
-
distance_m = 1_000_000 # Pass in the shipping distance in meters
|
132
|
-
package_mass_g = 10_000 # Pass in the weight of the package shipped in grams
|
133
|
-
transportation_method = "air" # Pass in the transportation method (air, rail, road, sea)
|
134
|
-
Patch::Estimate.create_shipping_estimate(
|
135
|
-
distance_m: distance_m,
|
136
|
-
package_mass_g: package_mass_g,
|
137
|
-
transportation_method: transportation_method
|
138
|
-
)
|
139
|
-
|
140
130
|
# Create a vehicle estimate
|
141
131
|
distance_m = 1_000_000 # Pass in the shipping distance in meters
|
142
132
|
make = "Toyota" # Pass in the car make
|
@@ -149,10 +139,20 @@ Patch::Estimate.create_vehicle_estimate(
|
|
149
139
|
year: year
|
150
140
|
)
|
151
141
|
|
152
|
-
# Create a
|
142
|
+
# Create a Bitcoin estimate
|
153
143
|
transaction_value_btc_sats = 1000; # [Optional] Pass in the transaction value in satoshis
|
154
144
|
Patch::Estimate.create_bitcoin_estimate(transaction_value_btc_sats: transaction_value_btc_sats)
|
155
145
|
|
146
|
+
# Create an ecommerce estimate
|
147
|
+
distance_m = 1_000_000 # Pass in the shipping distance in meters
|
148
|
+
package_mass_g = 10_000 # Pass in the weight of the package shipped in grams
|
149
|
+
transportation_method = "air" # Pass in the transportation method (air, rail, road, sea)
|
150
|
+
Patch::Estimate.create_ecommerce_estimate(
|
151
|
+
distance_m: distance_m,
|
152
|
+
package_mass_g: package_mass_g,
|
153
|
+
transportation_method: transportation_method
|
154
|
+
)
|
155
|
+
|
156
156
|
## You can also specify a project-id field (optional) to be used instead of the preferred one
|
157
157
|
project_id = 'pro_test_1234' # Pass in the project's ID
|
158
158
|
Patch::Estimate.create_mass_estimate(mass_g: mass, project_id: project_id)
|
@@ -15,11 +15,16 @@ require 'cgi'
|
|
15
15
|
module Patch
|
16
16
|
class EstimatesApi
|
17
17
|
OPERATIONS = [
|
18
|
+
:create_air_shipping_estimate,
|
18
19
|
:create_bitcoin_estimate,
|
20
|
+
:create_ecommerce_estimate,
|
19
21
|
:create_ethereum_estimate,
|
20
22
|
:create_flight_estimate,
|
21
23
|
:create_hotel_estimate,
|
22
24
|
:create_mass_estimate,
|
25
|
+
:create_rail_shipping_estimate,
|
26
|
+
:create_road_shipping_estimate,
|
27
|
+
:create_sea_shipping_estimate,
|
23
28
|
:create_shipping_estimate,
|
24
29
|
:create_vehicle_estimate,
|
25
30
|
:retrieve_estimate,
|
@@ -31,6 +36,75 @@ module Patch
|
|
31
36
|
def initialize(api_client = ApiClient.default)
|
32
37
|
@api_client = api_client
|
33
38
|
end
|
39
|
+
# Creates a GLEC air shipping estimate given freight mass and logistics
|
40
|
+
# 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.
|
41
|
+
# @param create_air_shipping_estimate_request [CreateAirShippingEstimateRequest]
|
42
|
+
# @param [Hash] opts the optional parameters
|
43
|
+
# @return [EstimateResponse]
|
44
|
+
def create_air_shipping_estimate(create_air_shipping_estimate_request = {}, opts = {})
|
45
|
+
_create_air_shipping_estimate_request = Patch::CreateAirShippingEstimateRequest.new(create_air_shipping_estimate_request)
|
46
|
+
data, _status_code, _headers = create_air_shipping_estimate_with_http_info(_create_air_shipping_estimate_request, opts)
|
47
|
+
data
|
48
|
+
end
|
49
|
+
|
50
|
+
# Creates a GLEC air shipping estimate given freight mass and logistics
|
51
|
+
# 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.
|
52
|
+
# @param create_air_shipping_estimate_request [CreateAirShippingEstimateRequest]
|
53
|
+
# @param [Hash] opts the optional parameters
|
54
|
+
# @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
|
55
|
+
def create_air_shipping_estimate_with_http_info(create_air_shipping_estimate_request, opts = {})
|
56
|
+
if @api_client.config.debugging
|
57
|
+
@api_client.config.logger.debug 'Calling API: EstimatesApi.create_air_shipping_estimate ...'
|
58
|
+
end
|
59
|
+
# verify the required parameter 'create_air_shipping_estimate_request' is set
|
60
|
+
if @api_client.config.client_side_validation && create_air_shipping_estimate_request.nil?
|
61
|
+
fail ArgumentError, "Missing the required parameter 'create_air_shipping_estimate_request' when calling EstimatesApi.create_air_shipping_estimate"
|
62
|
+
end
|
63
|
+
# resource path
|
64
|
+
local_var_path = '/v1/estimates/shipping/air'
|
65
|
+
|
66
|
+
# query parameters
|
67
|
+
query_params = opts[:query_params] || {}
|
68
|
+
|
69
|
+
# header parameters
|
70
|
+
header_params = opts[:header_params] || {}
|
71
|
+
# HTTP header 'Accept' (if needed)
|
72
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
73
|
+
# HTTP header 'Content-Type'
|
74
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
75
|
+
if !content_type.nil?
|
76
|
+
header_params['Content-Type'] = content_type
|
77
|
+
end
|
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
|
+
|
34
108
|
# Create a bitcoin estimate given a timestamp and transaction value
|
35
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.
|
36
110
|
# @param create_bitcoin_estimate_request [CreateBitcoinEstimateRequest]
|
@@ -43,7 +117,7 @@ module Patch
|
|
43
117
|
end
|
44
118
|
|
45
119
|
# Create a bitcoin estimate given a timestamp and transaction value
|
46
|
-
# Creates a bitcoin estimate for the amount of CO2 to be compensated. An order in the
|
120
|
+
# 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.
|
47
121
|
# @param create_bitcoin_estimate_request [CreateBitcoinEstimateRequest]
|
48
122
|
# @param [Hash] opts the optional parameters
|
49
123
|
# @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
|
@@ -100,6 +174,75 @@ module Patch
|
|
100
174
|
return data, status_code, headers
|
101
175
|
end
|
102
176
|
|
177
|
+
# Create an e-commerce estimate given the distance traveled in meters, package weight, and transportation method.
|
178
|
+
# Creates a e-commerce estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters.
|
179
|
+
# @param create_ecommerce_estimate_request [CreateEcommerceEstimateRequest]
|
180
|
+
# @param [Hash] opts the optional parameters
|
181
|
+
# @return [EstimateResponse]
|
182
|
+
def create_ecommerce_estimate(create_ecommerce_estimate_request = {}, opts = {})
|
183
|
+
_create_ecommerce_estimate_request = Patch::CreateEcommerceEstimateRequest.new(create_ecommerce_estimate_request)
|
184
|
+
data, _status_code, _headers = create_ecommerce_estimate_with_http_info(_create_ecommerce_estimate_request, opts)
|
185
|
+
data
|
186
|
+
end
|
187
|
+
|
188
|
+
# Create an e-commerce estimate given the distance traveled in meters, package weight, and transportation method.
|
189
|
+
# Creates a e-commerce estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters.
|
190
|
+
# @param create_ecommerce_estimate_request [CreateEcommerceEstimateRequest]
|
191
|
+
# @param [Hash] opts the optional parameters
|
192
|
+
# @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
|
193
|
+
def create_ecommerce_estimate_with_http_info(create_ecommerce_estimate_request, opts = {})
|
194
|
+
if @api_client.config.debugging
|
195
|
+
@api_client.config.logger.debug 'Calling API: EstimatesApi.create_ecommerce_estimate ...'
|
196
|
+
end
|
197
|
+
# verify the required parameter 'create_ecommerce_estimate_request' is set
|
198
|
+
if @api_client.config.client_side_validation && create_ecommerce_estimate_request.nil?
|
199
|
+
fail ArgumentError, "Missing the required parameter 'create_ecommerce_estimate_request' when calling EstimatesApi.create_ecommerce_estimate"
|
200
|
+
end
|
201
|
+
# resource path
|
202
|
+
local_var_path = '/v1/estimates/ecommerce'
|
203
|
+
|
204
|
+
# query parameters
|
205
|
+
query_params = opts[:query_params] || {}
|
206
|
+
|
207
|
+
# header parameters
|
208
|
+
header_params = opts[:header_params] || {}
|
209
|
+
# HTTP header 'Accept' (if needed)
|
210
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
211
|
+
# HTTP header 'Content-Type'
|
212
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
213
|
+
if !content_type.nil?
|
214
|
+
header_params['Content-Type'] = content_type
|
215
|
+
end
|
216
|
+
|
217
|
+
# form parameters
|
218
|
+
form_params = opts[:form_params] || {}
|
219
|
+
|
220
|
+
# http body (model)
|
221
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_ecommerce_estimate_request)
|
222
|
+
|
223
|
+
# return_type
|
224
|
+
return_type = opts[:debug_return_type] || 'EstimateResponse'
|
225
|
+
|
226
|
+
# auth_names
|
227
|
+
auth_names = opts[:debug_auth_names] || ['bearer_auth']
|
228
|
+
|
229
|
+
new_options = opts.merge(
|
230
|
+
:operation => :"EstimatesApi.create_ecommerce_estimate",
|
231
|
+
:header_params => header_params,
|
232
|
+
:query_params => query_params,
|
233
|
+
:form_params => form_params,
|
234
|
+
:body => post_body,
|
235
|
+
:auth_names => auth_names,
|
236
|
+
:return_type => return_type
|
237
|
+
)
|
238
|
+
|
239
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
240
|
+
if @api_client.config.debugging
|
241
|
+
@api_client.config.logger.debug "API called: EstimatesApi#create_ecommerce_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
242
|
+
end
|
243
|
+
return data, status_code, headers
|
244
|
+
end
|
245
|
+
|
103
246
|
# Create an ethereum estimate
|
104
247
|
# Creates an ethereum 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.
|
105
248
|
# @param create_ethereum_estimate_request [CreateEthereumEstimateRequest]
|
@@ -112,7 +255,7 @@ module Patch
|
|
112
255
|
end
|
113
256
|
|
114
257
|
# Create an ethereum estimate
|
115
|
-
# Creates an ethereum estimate for the amount of CO2 to be compensated. An order in the
|
258
|
+
# Creates an ethereum 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.
|
116
259
|
# @param create_ethereum_estimate_request [CreateEthereumEstimateRequest]
|
117
260
|
# @param [Hash] opts the optional parameters
|
118
261
|
# @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
|
@@ -181,7 +324,7 @@ module Patch
|
|
181
324
|
end
|
182
325
|
|
183
326
|
# Create a flight estimate given the distance traveled in meters
|
184
|
-
# Creates a flight estimate for the amount of CO2 to be compensated. An order in the
|
327
|
+
# 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.
|
185
328
|
# @param create_flight_estimate_request [CreateFlightEstimateRequest]
|
186
329
|
# @param [Hash] opts the optional parameters
|
187
330
|
# @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
|
@@ -250,7 +393,7 @@ module Patch
|
|
250
393
|
end
|
251
394
|
|
252
395
|
# Create a hotel estimate.
|
253
|
-
# Creates a hotel estimate for the amount of CO2 to be compensated. An order in the
|
396
|
+
# Creates a hotel estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters.
|
254
397
|
# @param create_hotel_estimate_request [CreateHotelEstimateRequest]
|
255
398
|
# @param [Hash] opts the optional parameters
|
256
399
|
# @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
|
@@ -319,7 +462,7 @@ module Patch
|
|
319
462
|
end
|
320
463
|
|
321
464
|
# Create an estimate based on mass of CO2
|
322
|
-
# Creates an estimate for the mass of CO2 to be compensated. An order in the
|
465
|
+
# 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.
|
323
466
|
# @param create_mass_estimate_request [CreateMassEstimateRequest]
|
324
467
|
# @param [Hash] opts the optional parameters
|
325
468
|
# @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
|
@@ -376,6 +519,213 @@ module Patch
|
|
376
519
|
return data, status_code, headers
|
377
520
|
end
|
378
521
|
|
522
|
+
# Creates a GLEC rail shipping estimate given freight mass and logistics
|
523
|
+
# 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.
|
524
|
+
# @param create_rail_shipping_estimate_request [CreateRailShippingEstimateRequest]
|
525
|
+
# @param [Hash] opts the optional parameters
|
526
|
+
# @return [EstimateResponse]
|
527
|
+
def create_rail_shipping_estimate(create_rail_shipping_estimate_request = {}, opts = {})
|
528
|
+
_create_rail_shipping_estimate_request = Patch::CreateRailShippingEstimateRequest.new(create_rail_shipping_estimate_request)
|
529
|
+
data, _status_code, _headers = create_rail_shipping_estimate_with_http_info(_create_rail_shipping_estimate_request, opts)
|
530
|
+
data
|
531
|
+
end
|
532
|
+
|
533
|
+
# Creates a GLEC rail shipping estimate given freight mass and logistics
|
534
|
+
# 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.
|
535
|
+
# @param create_rail_shipping_estimate_request [CreateRailShippingEstimateRequest]
|
536
|
+
# @param [Hash] opts the optional parameters
|
537
|
+
# @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
|
538
|
+
def create_rail_shipping_estimate_with_http_info(create_rail_shipping_estimate_request, opts = {})
|
539
|
+
if @api_client.config.debugging
|
540
|
+
@api_client.config.logger.debug 'Calling API: EstimatesApi.create_rail_shipping_estimate ...'
|
541
|
+
end
|
542
|
+
# verify the required parameter 'create_rail_shipping_estimate_request' is set
|
543
|
+
if @api_client.config.client_side_validation && create_rail_shipping_estimate_request.nil?
|
544
|
+
fail ArgumentError, "Missing the required parameter 'create_rail_shipping_estimate_request' when calling EstimatesApi.create_rail_shipping_estimate"
|
545
|
+
end
|
546
|
+
# resource path
|
547
|
+
local_var_path = '/v1/estimates/shipping/rail'
|
548
|
+
|
549
|
+
# query parameters
|
550
|
+
query_params = opts[:query_params] || {}
|
551
|
+
|
552
|
+
# header parameters
|
553
|
+
header_params = opts[:header_params] || {}
|
554
|
+
# HTTP header 'Accept' (if needed)
|
555
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
556
|
+
# HTTP header 'Content-Type'
|
557
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
558
|
+
if !content_type.nil?
|
559
|
+
header_params['Content-Type'] = content_type
|
560
|
+
end
|
561
|
+
|
562
|
+
# form parameters
|
563
|
+
form_params = opts[:form_params] || {}
|
564
|
+
|
565
|
+
# http body (model)
|
566
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_rail_shipping_estimate_request)
|
567
|
+
|
568
|
+
# return_type
|
569
|
+
return_type = opts[:debug_return_type] || 'EstimateResponse'
|
570
|
+
|
571
|
+
# auth_names
|
572
|
+
auth_names = opts[:debug_auth_names] || ['bearer_auth']
|
573
|
+
|
574
|
+
new_options = opts.merge(
|
575
|
+
:operation => :"EstimatesApi.create_rail_shipping_estimate",
|
576
|
+
:header_params => header_params,
|
577
|
+
:query_params => query_params,
|
578
|
+
:form_params => form_params,
|
579
|
+
:body => post_body,
|
580
|
+
:auth_names => auth_names,
|
581
|
+
:return_type => return_type
|
582
|
+
)
|
583
|
+
|
584
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
585
|
+
if @api_client.config.debugging
|
586
|
+
@api_client.config.logger.debug "API called: EstimatesApi#create_rail_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
587
|
+
end
|
588
|
+
return data, status_code, headers
|
589
|
+
end
|
590
|
+
|
591
|
+
# Creates a GLEC road shipping estimate given freight mass and logistics
|
592
|
+
# 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.
|
593
|
+
# @param create_road_shipping_estimate_request [CreateRoadShippingEstimateRequest]
|
594
|
+
# @param [Hash] opts the optional parameters
|
595
|
+
# @return [EstimateResponse]
|
596
|
+
def create_road_shipping_estimate(create_road_shipping_estimate_request = {}, opts = {})
|
597
|
+
_create_road_shipping_estimate_request = Patch::CreateRoadShippingEstimateRequest.new(create_road_shipping_estimate_request)
|
598
|
+
data, _status_code, _headers = create_road_shipping_estimate_with_http_info(_create_road_shipping_estimate_request, opts)
|
599
|
+
data
|
600
|
+
end
|
601
|
+
|
602
|
+
# Creates a GLEC road shipping estimate given freight mass and logistics
|
603
|
+
# 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.
|
604
|
+
# @param create_road_shipping_estimate_request [CreateRoadShippingEstimateRequest]
|
605
|
+
# @param [Hash] opts the optional parameters
|
606
|
+
# @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
|
607
|
+
def create_road_shipping_estimate_with_http_info(create_road_shipping_estimate_request, opts = {})
|
608
|
+
if @api_client.config.debugging
|
609
|
+
@api_client.config.logger.debug 'Calling API: EstimatesApi.create_road_shipping_estimate ...'
|
610
|
+
end
|
611
|
+
# verify the required parameter 'create_road_shipping_estimate_request' is set
|
612
|
+
if @api_client.config.client_side_validation && create_road_shipping_estimate_request.nil?
|
613
|
+
fail ArgumentError, "Missing the required parameter 'create_road_shipping_estimate_request' when calling EstimatesApi.create_road_shipping_estimate"
|
614
|
+
end
|
615
|
+
# resource path
|
616
|
+
local_var_path = '/v1/estimates/shipping/road'
|
617
|
+
|
618
|
+
# query parameters
|
619
|
+
query_params = opts[:query_params] || {}
|
620
|
+
|
621
|
+
# header parameters
|
622
|
+
header_params = opts[:header_params] || {}
|
623
|
+
# HTTP header 'Accept' (if needed)
|
624
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
625
|
+
# HTTP header 'Content-Type'
|
626
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
627
|
+
if !content_type.nil?
|
628
|
+
header_params['Content-Type'] = content_type
|
629
|
+
end
|
630
|
+
|
631
|
+
# form parameters
|
632
|
+
form_params = opts[:form_params] || {}
|
633
|
+
|
634
|
+
# http body (model)
|
635
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_road_shipping_estimate_request)
|
636
|
+
|
637
|
+
# return_type
|
638
|
+
return_type = opts[:debug_return_type] || 'EstimateResponse'
|
639
|
+
|
640
|
+
# auth_names
|
641
|
+
auth_names = opts[:debug_auth_names] || ['bearer_auth']
|
642
|
+
|
643
|
+
new_options = opts.merge(
|
644
|
+
:operation => :"EstimatesApi.create_road_shipping_estimate",
|
645
|
+
:header_params => header_params,
|
646
|
+
:query_params => query_params,
|
647
|
+
:form_params => form_params,
|
648
|
+
:body => post_body,
|
649
|
+
:auth_names => auth_names,
|
650
|
+
:return_type => return_type
|
651
|
+
)
|
652
|
+
|
653
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
654
|
+
if @api_client.config.debugging
|
655
|
+
@api_client.config.logger.debug "API called: EstimatesApi#create_road_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
656
|
+
end
|
657
|
+
return data, status_code, headers
|
658
|
+
end
|
659
|
+
|
660
|
+
# Creates a GLEC sea shipping estimate given freight mass and logistics
|
661
|
+
# 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.
|
662
|
+
# @param create_sea_shipping_estimate_request [CreateSeaShippingEstimateRequest]
|
663
|
+
# @param [Hash] opts the optional parameters
|
664
|
+
# @return [EstimateResponse]
|
665
|
+
def create_sea_shipping_estimate(create_sea_shipping_estimate_request = {}, opts = {})
|
666
|
+
_create_sea_shipping_estimate_request = Patch::CreateSeaShippingEstimateRequest.new(create_sea_shipping_estimate_request)
|
667
|
+
data, _status_code, _headers = create_sea_shipping_estimate_with_http_info(_create_sea_shipping_estimate_request, opts)
|
668
|
+
data
|
669
|
+
end
|
670
|
+
|
671
|
+
# Creates a GLEC sea shipping estimate given freight mass and logistics
|
672
|
+
# 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.
|
673
|
+
# @param create_sea_shipping_estimate_request [CreateSeaShippingEstimateRequest]
|
674
|
+
# @param [Hash] opts the optional parameters
|
675
|
+
# @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
|
676
|
+
def create_sea_shipping_estimate_with_http_info(create_sea_shipping_estimate_request, opts = {})
|
677
|
+
if @api_client.config.debugging
|
678
|
+
@api_client.config.logger.debug 'Calling API: EstimatesApi.create_sea_shipping_estimate ...'
|
679
|
+
end
|
680
|
+
# verify the required parameter 'create_sea_shipping_estimate_request' is set
|
681
|
+
if @api_client.config.client_side_validation && create_sea_shipping_estimate_request.nil?
|
682
|
+
fail ArgumentError, "Missing the required parameter 'create_sea_shipping_estimate_request' when calling EstimatesApi.create_sea_shipping_estimate"
|
683
|
+
end
|
684
|
+
# resource path
|
685
|
+
local_var_path = '/v1/estimates/shipping/sea'
|
686
|
+
|
687
|
+
# query parameters
|
688
|
+
query_params = opts[:query_params] || {}
|
689
|
+
|
690
|
+
# header parameters
|
691
|
+
header_params = opts[:header_params] || {}
|
692
|
+
# HTTP header 'Accept' (if needed)
|
693
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
694
|
+
# HTTP header 'Content-Type'
|
695
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
696
|
+
if !content_type.nil?
|
697
|
+
header_params['Content-Type'] = content_type
|
698
|
+
end
|
699
|
+
|
700
|
+
# form parameters
|
701
|
+
form_params = opts[:form_params] || {}
|
702
|
+
|
703
|
+
# http body (model)
|
704
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_sea_shipping_estimate_request)
|
705
|
+
|
706
|
+
# return_type
|
707
|
+
return_type = opts[:debug_return_type] || 'EstimateResponse'
|
708
|
+
|
709
|
+
# auth_names
|
710
|
+
auth_names = opts[:debug_auth_names] || ['bearer_auth']
|
711
|
+
|
712
|
+
new_options = opts.merge(
|
713
|
+
:operation => :"EstimatesApi.create_sea_shipping_estimate",
|
714
|
+
:header_params => header_params,
|
715
|
+
:query_params => query_params,
|
716
|
+
:form_params => form_params,
|
717
|
+
:body => post_body,
|
718
|
+
:auth_names => auth_names,
|
719
|
+
:return_type => return_type
|
720
|
+
)
|
721
|
+
|
722
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
723
|
+
if @api_client.config.debugging
|
724
|
+
@api_client.config.logger.debug "API called: EstimatesApi#create_sea_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
725
|
+
end
|
726
|
+
return data, status_code, headers
|
727
|
+
end
|
728
|
+
|
379
729
|
# Create a shipping estimate given the distance traveled in meters, package weight, and transportation method.
|
380
730
|
# Creates a shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters.
|
381
731
|
# @param create_shipping_estimate_request [CreateShippingEstimateRequest]
|
@@ -388,7 +738,7 @@ module Patch
|
|
388
738
|
end
|
389
739
|
|
390
740
|
# Create a shipping estimate given the distance traveled in meters, package weight, and transportation method.
|
391
|
-
# Creates a shipping estimate for the amount of CO2 to be compensated. An order in the
|
741
|
+
# Creates a shipping estimate for the amount of CO2 to be compensated. An order in the `draft` state may be created based on the parameters.
|
392
742
|
# @param create_shipping_estimate_request [CreateShippingEstimateRequest]
|
393
743
|
# @param [Hash] opts the optional parameters
|
394
744
|
# @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
|
@@ -457,7 +807,7 @@ module Patch
|
|
457
807
|
end
|
458
808
|
|
459
809
|
# Create a vehicle estimate given the distance traveled in meters and the type of vehicle
|
460
|
-
# Creates an estimate and calculates the amount of CO2 to be compensated depending on the distance and the vehicle. An order in the
|
810
|
+
# Creates an estimate and calculates the amount of CO2 to be compensated depending on the distance and the vehicle. An order in the `draft` state may be created based on the parameters, linked to the estimate.
|
461
811
|
# @param create_vehicle_estimate_request [CreateVehicleEstimateRequest]
|
462
812
|
# @param [Hash] opts the optional parameters
|
463
813
|
# @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers
|