|
| 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: 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 ShippingApi |
| 17 | + OPERATIONS = [ |
| 18 | + :create_air_shipping_estimate, |
| 19 | + :create_rail_shipping_estimate, |
| 20 | + :create_road_shipping_estimate, |
| 21 | + :create_sea_shipping_estimate, |
| 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 GLEC air shipping estimate given freight mass and logistics |
| 30 | + # 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. |
| 31 | + # @param create_air_shipping_estimate_request [CreateAirShippingEstimateRequest] |
| 32 | + # @param [Hash] opts the optional parameters |
| 33 | + # @return [EstimateResponse] |
| 34 | + def create_air_shipping_estimate(create_air_shipping_estimate_request = {}, opts = {}) |
| 35 | + _create_air_shipping_estimate_request = Patch::CreateAirShippingEstimateRequest.new(create_air_shipping_estimate_request) |
| 36 | + data, _status_code, _headers = create_air_shipping_estimate_with_http_info(_create_air_shipping_estimate_request, opts) |
| 37 | + data |
| 38 | + end |
| 39 | + |
| 40 | + # Creates a GLEC air shipping estimate given freight mass and logistics |
| 41 | + # 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. |
| 42 | + # @param create_air_shipping_estimate_request [CreateAirShippingEstimateRequest] |
| 43 | + # @param [Hash] opts the optional parameters |
| 44 | + # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers |
| 45 | + def create_air_shipping_estimate_with_http_info(create_air_shipping_estimate_request, opts = {}) |
| 46 | + if @api_client.config.debugging |
| 47 | + @api_client.config.logger.debug 'Calling API: ShippingApi.create_air_shipping_estimate ...' |
| 48 | + end |
| 49 | + # verify the required parameter 'create_air_shipping_estimate_request' is set |
| 50 | + if @api_client.config.client_side_validation && create_air_shipping_estimate_request.nil? |
| 51 | + fail ArgumentError, "Missing the required parameter 'create_air_shipping_estimate_request' when calling ShippingApi.create_air_shipping_estimate" |
| 52 | + end |
| 53 | + # resource path |
| 54 | + local_var_path = '/v1/shipping/air' |
| 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 | + content_type = @api_client.select_header_content_type(['application/json']) |
| 65 | + if !content_type.nil? |
| 66 | + header_params['Content-Type'] = content_type |
| 67 | + end |
| 68 | + |
| 69 | + # form parameters |
| 70 | + form_params = opts[:form_params] || {} |
| 71 | + |
| 72 | + # http body (model) |
| 73 | + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_air_shipping_estimate_request) |
| 74 | + |
| 75 | + # return_type |
| 76 | + return_type = opts[:debug_return_type] || 'EstimateResponse' |
| 77 | + |
| 78 | + # auth_names |
| 79 | + auth_names = opts[:debug_auth_names] || ['bearer_auth'] |
| 80 | + |
| 81 | + new_options = opts.merge( |
| 82 | + :operation => :"ShippingApi.create_air_shipping_estimate", |
| 83 | + :header_params => header_params, |
| 84 | + :query_params => query_params, |
| 85 | + :form_params => form_params, |
| 86 | + :body => post_body, |
| 87 | + :auth_names => auth_names, |
| 88 | + :return_type => return_type |
| 89 | + ) |
| 90 | + |
| 91 | + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) |
| 92 | + if @api_client.config.debugging |
| 93 | + @api_client.config.logger.debug "API called: ShippingApi#create_air_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 94 | + end |
| 95 | + return data, status_code, headers |
| 96 | + end |
| 97 | + |
| 98 | + # Creates a GLEC rail shipping estimate given freight mass and logistics |
| 99 | + # 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. |
| 100 | + # @param create_rail_shipping_estimate_request [CreateRailShippingEstimateRequest] |
| 101 | + # @param [Hash] opts the optional parameters |
| 102 | + # @return [EstimateResponse] |
| 103 | + def create_rail_shipping_estimate(create_rail_shipping_estimate_request = {}, opts = {}) |
| 104 | + _create_rail_shipping_estimate_request = Patch::CreateRailShippingEstimateRequest.new(create_rail_shipping_estimate_request) |
| 105 | + data, _status_code, _headers = create_rail_shipping_estimate_with_http_info(_create_rail_shipping_estimate_request, opts) |
| 106 | + data |
| 107 | + end |
| 108 | + |
| 109 | + # Creates a GLEC rail shipping estimate given freight mass and logistics |
| 110 | + # 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. |
| 111 | + # @param create_rail_shipping_estimate_request [CreateRailShippingEstimateRequest] |
| 112 | + # @param [Hash] opts the optional parameters |
| 113 | + # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers |
| 114 | + def create_rail_shipping_estimate_with_http_info(create_rail_shipping_estimate_request, opts = {}) |
| 115 | + if @api_client.config.debugging |
| 116 | + @api_client.config.logger.debug 'Calling API: ShippingApi.create_rail_shipping_estimate ...' |
| 117 | + end |
| 118 | + # verify the required parameter 'create_rail_shipping_estimate_request' is set |
| 119 | + if @api_client.config.client_side_validation && create_rail_shipping_estimate_request.nil? |
| 120 | + fail ArgumentError, "Missing the required parameter 'create_rail_shipping_estimate_request' when calling ShippingApi.create_rail_shipping_estimate" |
| 121 | + end |
| 122 | + # resource path |
| 123 | + local_var_path = '/v1/shipping/rail' |
| 124 | + |
| 125 | + # query parameters |
| 126 | + query_params = opts[:query_params] || {} |
| 127 | + |
| 128 | + # header parameters |
| 129 | + header_params = opts[:header_params] || {} |
| 130 | + # HTTP header 'Accept' (if needed) |
| 131 | + header_params['Accept'] = @api_client.select_header_accept(['application/json']) |
| 132 | + # HTTP header 'Content-Type' |
| 133 | + content_type = @api_client.select_header_content_type(['application/json']) |
| 134 | + if !content_type.nil? |
| 135 | + header_params['Content-Type'] = content_type |
| 136 | + end |
| 137 | + |
| 138 | + # form parameters |
| 139 | + form_params = opts[:form_params] || {} |
| 140 | + |
| 141 | + # http body (model) |
| 142 | + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_rail_shipping_estimate_request) |
| 143 | + |
| 144 | + # return_type |
| 145 | + return_type = opts[:debug_return_type] || 'EstimateResponse' |
| 146 | + |
| 147 | + # auth_names |
| 148 | + auth_names = opts[:debug_auth_names] || ['bearer_auth'] |
| 149 | + |
| 150 | + new_options = opts.merge( |
| 151 | + :operation => :"ShippingApi.create_rail_shipping_estimate", |
| 152 | + :header_params => header_params, |
| 153 | + :query_params => query_params, |
| 154 | + :form_params => form_params, |
| 155 | + :body => post_body, |
| 156 | + :auth_names => auth_names, |
| 157 | + :return_type => return_type |
| 158 | + ) |
| 159 | + |
| 160 | + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) |
| 161 | + if @api_client.config.debugging |
| 162 | + @api_client.config.logger.debug "API called: ShippingApi#create_rail_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 163 | + end |
| 164 | + return data, status_code, headers |
| 165 | + end |
| 166 | + |
| 167 | + # Creates a GLEC road shipping estimate given freight mass and logistics |
| 168 | + # 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. |
| 169 | + # @param create_road_shipping_estimate_request [CreateRoadShippingEstimateRequest] |
| 170 | + # @param [Hash] opts the optional parameters |
| 171 | + # @return [EstimateResponse] |
| 172 | + def create_road_shipping_estimate(create_road_shipping_estimate_request = {}, opts = {}) |
| 173 | + _create_road_shipping_estimate_request = Patch::CreateRoadShippingEstimateRequest.new(create_road_shipping_estimate_request) |
| 174 | + data, _status_code, _headers = create_road_shipping_estimate_with_http_info(_create_road_shipping_estimate_request, opts) |
| 175 | + data |
| 176 | + end |
| 177 | + |
| 178 | + # Creates a GLEC road shipping estimate given freight mass and logistics |
| 179 | + # 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. |
| 180 | + # @param create_road_shipping_estimate_request [CreateRoadShippingEstimateRequest] |
| 181 | + # @param [Hash] opts the optional parameters |
| 182 | + # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers |
| 183 | + def create_road_shipping_estimate_with_http_info(create_road_shipping_estimate_request, opts = {}) |
| 184 | + if @api_client.config.debugging |
| 185 | + @api_client.config.logger.debug 'Calling API: ShippingApi.create_road_shipping_estimate ...' |
| 186 | + end |
| 187 | + # verify the required parameter 'create_road_shipping_estimate_request' is set |
| 188 | + if @api_client.config.client_side_validation && create_road_shipping_estimate_request.nil? |
| 189 | + fail ArgumentError, "Missing the required parameter 'create_road_shipping_estimate_request' when calling ShippingApi.create_road_shipping_estimate" |
| 190 | + end |
| 191 | + # resource path |
| 192 | + local_var_path = '/v1/shipping/road' |
| 193 | + |
| 194 | + # query parameters |
| 195 | + query_params = opts[:query_params] || {} |
| 196 | + |
| 197 | + # header parameters |
| 198 | + header_params = opts[:header_params] || {} |
| 199 | + # HTTP header 'Accept' (if needed) |
| 200 | + header_params['Accept'] = @api_client.select_header_accept(['application/json']) |
| 201 | + # HTTP header 'Content-Type' |
| 202 | + content_type = @api_client.select_header_content_type(['application/json']) |
| 203 | + if !content_type.nil? |
| 204 | + header_params['Content-Type'] = content_type |
| 205 | + end |
| 206 | + |
| 207 | + # form parameters |
| 208 | + form_params = opts[:form_params] || {} |
| 209 | + |
| 210 | + # http body (model) |
| 211 | + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_road_shipping_estimate_request) |
| 212 | + |
| 213 | + # return_type |
| 214 | + return_type = opts[:debug_return_type] || 'EstimateResponse' |
| 215 | + |
| 216 | + # auth_names |
| 217 | + auth_names = opts[:debug_auth_names] || ['bearer_auth'] |
| 218 | + |
| 219 | + new_options = opts.merge( |
| 220 | + :operation => :"ShippingApi.create_road_shipping_estimate", |
| 221 | + :header_params => header_params, |
| 222 | + :query_params => query_params, |
| 223 | + :form_params => form_params, |
| 224 | + :body => post_body, |
| 225 | + :auth_names => auth_names, |
| 226 | + :return_type => return_type |
| 227 | + ) |
| 228 | + |
| 229 | + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) |
| 230 | + if @api_client.config.debugging |
| 231 | + @api_client.config.logger.debug "API called: ShippingApi#create_road_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 232 | + end |
| 233 | + return data, status_code, headers |
| 234 | + end |
| 235 | + |
| 236 | + # Creates a GLEC sea shipping estimate given freight mass and logistics |
| 237 | + # 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. |
| 238 | + # @param create_sea_shipping_estimate_request [CreateSeaShippingEstimateRequest] |
| 239 | + # @param [Hash] opts the optional parameters |
| 240 | + # @return [EstimateResponse] |
| 241 | + def create_sea_shipping_estimate(create_sea_shipping_estimate_request = {}, opts = {}) |
| 242 | + _create_sea_shipping_estimate_request = Patch::CreateSeaShippingEstimateRequest.new(create_sea_shipping_estimate_request) |
| 243 | + data, _status_code, _headers = create_sea_shipping_estimate_with_http_info(_create_sea_shipping_estimate_request, opts) |
| 244 | + data |
| 245 | + end |
| 246 | + |
| 247 | + # Creates a GLEC sea shipping estimate given freight mass and logistics |
| 248 | + # 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. |
| 249 | + # @param create_sea_shipping_estimate_request [CreateSeaShippingEstimateRequest] |
| 250 | + # @param [Hash] opts the optional parameters |
| 251 | + # @return [Array<(EstimateResponse, Integer, Hash)>] EstimateResponse data, response status code and response headers |
| 252 | + def create_sea_shipping_estimate_with_http_info(create_sea_shipping_estimate_request, opts = {}) |
| 253 | + if @api_client.config.debugging |
| 254 | + @api_client.config.logger.debug 'Calling API: ShippingApi.create_sea_shipping_estimate ...' |
| 255 | + end |
| 256 | + # verify the required parameter 'create_sea_shipping_estimate_request' is set |
| 257 | + if @api_client.config.client_side_validation && create_sea_shipping_estimate_request.nil? |
| 258 | + fail ArgumentError, "Missing the required parameter 'create_sea_shipping_estimate_request' when calling ShippingApi.create_sea_shipping_estimate" |
| 259 | + end |
| 260 | + # resource path |
| 261 | + local_var_path = '/v1/shipping/sea' |
| 262 | + |
| 263 | + # query parameters |
| 264 | + query_params = opts[:query_params] || {} |
| 265 | + |
| 266 | + # header parameters |
| 267 | + header_params = opts[:header_params] || {} |
| 268 | + # HTTP header 'Accept' (if needed) |
| 269 | + header_params['Accept'] = @api_client.select_header_accept(['application/json']) |
| 270 | + # HTTP header 'Content-Type' |
| 271 | + content_type = @api_client.select_header_content_type(['application/json']) |
| 272 | + if !content_type.nil? |
| 273 | + header_params['Content-Type'] = content_type |
| 274 | + end |
| 275 | + |
| 276 | + # form parameters |
| 277 | + form_params = opts[:form_params] || {} |
| 278 | + |
| 279 | + # http body (model) |
| 280 | + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_sea_shipping_estimate_request) |
| 281 | + |
| 282 | + # return_type |
| 283 | + return_type = opts[:debug_return_type] || 'EstimateResponse' |
| 284 | + |
| 285 | + # auth_names |
| 286 | + auth_names = opts[:debug_auth_names] || ['bearer_auth'] |
| 287 | + |
| 288 | + new_options = opts.merge( |
| 289 | + :operation => :"ShippingApi.create_sea_shipping_estimate", |
| 290 | + :header_params => header_params, |
| 291 | + :query_params => query_params, |
| 292 | + :form_params => form_params, |
| 293 | + :body => post_body, |
| 294 | + :auth_names => auth_names, |
| 295 | + :return_type => return_type |
| 296 | + ) |
| 297 | + |
| 298 | + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) |
| 299 | + if @api_client.config.debugging |
| 300 | + @api_client.config.logger.debug "API called: ShippingApi#create_sea_shipping_estimate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 301 | + end |
| 302 | + return data, status_code, headers |
| 303 | + end |
| 304 | + end |
| 305 | +end |
0 commit comments