class ShipEngine::RatesApi
Attributes
Public Class Methods
# File lib/ship_engine/api/rates_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Get Shipping Rates It's not uncommon that you want to give your customer the choice between whether they want to ship the fastest, cheapest, or the most trusted route. Most companies don't solely ship things using a single shipping option; so we provide functionality to show you all your options! @param calculate_rates_request_body [CalculateRatesRequestBody] @param [Hash] opts the optional parameters @return [CalculateRatesResponseBody]
# File lib/ship_engine/api/rates_api.rb, line 27 def calculate_rates(calculate_rates_request_body, opts = {}) data, _status_code, _headers = calculate_rates_with_http_info(calculate_rates_request_body, opts) data end
Get Shipping Rates It's not uncommon that you want to give your customer the choice between whether they want to ship the fastest, cheapest, or the most trusted route. Most companies don't solely ship things using a single shipping option; so we provide functionality to show you all your options! @param calculate_rates_request_body [CalculateRatesRequestBody] @param [Hash] opts the optional parameters @return [Array<(CalculateRatesResponseBody
, Integer, Hash)>] CalculateRatesResponseBody
data, response status code and response headers
# File lib/ship_engine/api/rates_api.rb, line 37 def calculate_rates_with_http_info(calculate_rates_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RatesApi.calculate_rates ...' end # verify the required parameter 'calculate_rates_request_body' is set if @api_client.config.client_side_validation && calculate_rates_request_body.nil? fail ArgumentError, "Missing the required parameter 'calculate_rates_request_body' when calling RatesApi.calculate_rates" end # resource path local_var_path = '/v1/rates' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(calculate_rates_request_body) # return_type return_type = opts[:return_type] || 'CalculateRatesResponseBody' # auth_names auth_names = opts[:auth_names] || ['api_key'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RatesApi#calculate_rates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Bulk Rates Get Bulk Shipment
Rates @param compare_bulk_rates_request_body [CompareBulkRatesRequestBody] @param [Hash] opts the optional parameters @return [Array<BulkRate>]
# File lib/ship_engine/api/rates_api.rb, line 91 def compare_bulk_rates(compare_bulk_rates_request_body, opts = {}) data, _status_code, _headers = compare_bulk_rates_with_http_info(compare_bulk_rates_request_body, opts) data end
Get Bulk Rates Get Bulk Shipment
Rates @param compare_bulk_rates_request_body [CompareBulkRatesRequestBody] @param [Hash] opts the optional parameters @return [Array<(Array<BulkRate>, Integer, Hash)>] Array<BulkRate> data, response status code and response headers
# File lib/ship_engine/api/rates_api.rb, line 101 def compare_bulk_rates_with_http_info(compare_bulk_rates_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RatesApi.compare_bulk_rates ...' end # verify the required parameter 'compare_bulk_rates_request_body' is set if @api_client.config.client_side_validation && compare_bulk_rates_request_body.nil? fail ArgumentError, "Missing the required parameter 'compare_bulk_rates_request_body' when calling RatesApi.compare_bulk_rates" end # resource path local_var_path = '/v1/rates/bulk' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(compare_bulk_rates_request_body) # return_type return_type = opts[:return_type] || 'Array<BulkRate>' # auth_names auth_names = opts[:auth_names] || ['api_key'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RatesApi#compare_bulk_rates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Estimate Rates Get Rate
Estimates @param estimate_rates_request_body [EstimateRatesRequestBody] @param [Hash] opts the optional parameters @return [Array<Rate>]
# File lib/ship_engine/api/rates_api.rb, line 155 def estimate_rates(estimate_rates_request_body, opts = {}) data, _status_code, _headers = estimate_rates_with_http_info(estimate_rates_request_body, opts) data end
Estimate Rates Get Rate
Estimates @param estimate_rates_request_body [EstimateRatesRequestBody] @param [Hash] opts the optional parameters @return [Array<(Array<Rate>, Integer, Hash)>] Array<Rate> data, response status code and response headers
# File lib/ship_engine/api/rates_api.rb, line 165 def estimate_rates_with_http_info(estimate_rates_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RatesApi.estimate_rates ...' end # verify the required parameter 'estimate_rates_request_body' is set if @api_client.config.client_side_validation && estimate_rates_request_body.nil? fail ArgumentError, "Missing the required parameter 'estimate_rates_request_body' when calling RatesApi.estimate_rates" end # resource path local_var_path = '/v1/rates/estimate' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(estimate_rates_request_body) # return_type return_type = opts[:return_type] || 'Array<Rate>' # auth_names auth_names = opts[:auth_names] || ['api_key'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RatesApi#estimate_rates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Rate
By ID Retrieve a previously queried rate by its ID @param rate_id [String] Rate
ID @param [Hash] opts the optional parameters @return [GetRateByIdResponseBody]
# File lib/ship_engine/api/rates_api.rb, line 219 def get_rate_by_id(rate_id, opts = {}) data, _status_code, _headers = get_rate_by_id_with_http_info(rate_id, opts) data end
Get Rate
By ID Retrieve a previously queried rate by its ID @param rate_id [String] Rate
ID @param [Hash] opts the optional parameters @return [Array<(GetRateByIdResponseBody
, Integer, Hash)>] GetRateByIdResponseBody
data, response status code and response headers
# File lib/ship_engine/api/rates_api.rb, line 229 def get_rate_by_id_with_http_info(rate_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RatesApi.get_rate_by_id ...' end # verify the required parameter 'rate_id' is set if @api_client.config.client_side_validation && rate_id.nil? fail ArgumentError, "Missing the required parameter 'rate_id' when calling RatesApi.get_rate_by_id" end if @api_client.config.client_side_validation && rate_id.to_s.length > 25 fail ArgumentError, 'invalid value for "rate_id" when calling RatesApi.get_rate_by_id, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && rate_id.to_s.length < 1 fail ArgumentError, 'invalid value for "rate_id" when calling RatesApi.get_rate_by_id, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^se(-[a-z0-9]+)+$/) if @api_client.config.client_side_validation && rate_id !~ pattern fail ArgumentError, "invalid value for 'rate_id' when calling RatesApi.get_rate_by_id, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/rates/{rate_id}'.sub('{' + 'rate_id' + '}', CGI.escape(rate_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'GetRateByIdResponseBody' # auth_names auth_names = opts[:auth_names] || ['api_key'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RatesApi#get_rate_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end