class ShipEngine::CarriersApi
Attributes
Public Class Methods
# File lib/ship_engine/api/carriers_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Add Funds To Carrier
Add Funds To A Carrier
@param add_funds_to_carrier_request_body [AddFundsToCarrierRequestBody] @param carrier_id [String] Carrier
ID @param [Hash] opts the optional parameters @return [AddFundsToCarrierResponseBody]
# File lib/ship_engine/api/carriers_api.rb, line 28 def add_funds_to_carrier(add_funds_to_carrier_request_body, carrier_id, opts = {}) data, _status_code, _headers = add_funds_to_carrier_with_http_info(add_funds_to_carrier_request_body, carrier_id, opts) data end
Add Funds To Carrier
Add Funds To A Carrier
@param add_funds_to_carrier_request_body [AddFundsToCarrierRequestBody] @param carrier_id [String] Carrier
ID @param [Hash] opts the optional parameters @return [Array<(AddFundsToCarrierResponseBody
, Integer, Hash)>] AddFundsToCarrierResponseBody
data, response status code and response headers
# File lib/ship_engine/api/carriers_api.rb, line 39 def add_funds_to_carrier_with_http_info(add_funds_to_carrier_request_body, carrier_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CarriersApi.add_funds_to_carrier ...' end # verify the required parameter 'add_funds_to_carrier_request_body' is set if @api_client.config.client_side_validation && add_funds_to_carrier_request_body.nil? fail ArgumentError, "Missing the required parameter 'add_funds_to_carrier_request_body' when calling CarriersApi.add_funds_to_carrier" end # verify the required parameter 'carrier_id' is set if @api_client.config.client_side_validation && carrier_id.nil? fail ArgumentError, "Missing the required parameter 'carrier_id' when calling CarriersApi.add_funds_to_carrier" end if @api_client.config.client_side_validation && carrier_id.to_s.length > 25 fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.add_funds_to_carrier, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && carrier_id.to_s.length < 1 fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.add_funds_to_carrier, 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 && carrier_id !~ pattern fail ArgumentError, "invalid value for 'carrier_id' when calling CarriersApi.add_funds_to_carrier, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/carriers/{carrier_id}/add_funds'.sub('{' + 'carrier_id' + '}', CGI.escape(carrier_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']) # 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(add_funds_to_carrier_request_body) # return_type return_type = opts[:return_type] || 'AddFundsToCarrierResponseBody' # 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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: CarriersApi#add_funds_to_carrier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Carrier
By ID Retrive carrier info by ID @param carrier_id [String] Carrier
ID @param [Hash] opts the optional parameters @return [GetCarrierByIdResponseBody]
# File lib/ship_engine/api/carriers_api.rb, line 110 def get_carrier_by_id(carrier_id, opts = {}) data, _status_code, _headers = get_carrier_by_id_with_http_info(carrier_id, opts) data end
Get Carrier
By ID Retrive carrier info by ID @param carrier_id [String] Carrier
ID @param [Hash] opts the optional parameters @return [Array<(GetCarrierByIdResponseBody
, Integer, Hash)>] GetCarrierByIdResponseBody
data, response status code and response headers
# File lib/ship_engine/api/carriers_api.rb, line 120 def get_carrier_by_id_with_http_info(carrier_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CarriersApi.get_carrier_by_id ...' end # verify the required parameter 'carrier_id' is set if @api_client.config.client_side_validation && carrier_id.nil? fail ArgumentError, "Missing the required parameter 'carrier_id' when calling CarriersApi.get_carrier_by_id" end if @api_client.config.client_side_validation && carrier_id.to_s.length > 25 fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.get_carrier_by_id, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && carrier_id.to_s.length < 1 fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.get_carrier_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 && carrier_id !~ pattern fail ArgumentError, "invalid value for 'carrier_id' when calling CarriersApi.get_carrier_by_id, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/carriers/{carrier_id}'.sub('{' + 'carrier_id' + '}', CGI.escape(carrier_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] || 'GetCarrierByIdResponseBody' # 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: CarriersApi#get_carrier_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Carrier
Options Get a list of the options available for the carrier @param carrier_id [String] Carrier
ID @param [Hash] opts the optional parameters @return [GetCarrierOptionsResponseBody]
# File lib/ship_engine/api/carriers_api.rb, line 185 def get_carrier_options(carrier_id, opts = {}) data, _status_code, _headers = get_carrier_options_with_http_info(carrier_id, opts) data end
Get Carrier
Options Get a list of the options available for the carrier @param carrier_id [String] Carrier
ID @param [Hash] opts the optional parameters @return [Array<(GetCarrierOptionsResponseBody
, Integer, Hash)>] GetCarrierOptionsResponseBody
data, response status code and response headers
# File lib/ship_engine/api/carriers_api.rb, line 195 def get_carrier_options_with_http_info(carrier_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CarriersApi.get_carrier_options ...' end # verify the required parameter 'carrier_id' is set if @api_client.config.client_side_validation && carrier_id.nil? fail ArgumentError, "Missing the required parameter 'carrier_id' when calling CarriersApi.get_carrier_options" end if @api_client.config.client_side_validation && carrier_id.to_s.length > 25 fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.get_carrier_options, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && carrier_id.to_s.length < 1 fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.get_carrier_options, 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 && carrier_id !~ pattern fail ArgumentError, "invalid value for 'carrier_id' when calling CarriersApi.get_carrier_options, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/carriers/{carrier_id}/options'.sub('{' + 'carrier_id' + '}', CGI.escape(carrier_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] || 'GetCarrierOptionsResponseBody' # 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: CarriersApi#get_carrier_options\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List Carrier
Package
Types List the package types associated with the carrier @param carrier_id [String] Carrier
ID @param [Hash] opts the optional parameters @return [ListCarrierPackageTypesResponseBody]
# File lib/ship_engine/api/carriers_api.rb, line 260 def list_carrier_package_types(carrier_id, opts = {}) data, _status_code, _headers = list_carrier_package_types_with_http_info(carrier_id, opts) data end
List Carrier
Package
Types List the package types associated with the carrier @param carrier_id [String] Carrier
ID @param [Hash] opts the optional parameters @return [Array<(ListCarrierPackageTypesResponseBody
, Integer, Hash)>] ListCarrierPackageTypesResponseBody
data, response status code and response headers
# File lib/ship_engine/api/carriers_api.rb, line 270 def list_carrier_package_types_with_http_info(carrier_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CarriersApi.list_carrier_package_types ...' end # verify the required parameter 'carrier_id' is set if @api_client.config.client_side_validation && carrier_id.nil? fail ArgumentError, "Missing the required parameter 'carrier_id' when calling CarriersApi.list_carrier_package_types" end if @api_client.config.client_side_validation && carrier_id.to_s.length > 25 fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.list_carrier_package_types, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && carrier_id.to_s.length < 1 fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.list_carrier_package_types, 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 && carrier_id !~ pattern fail ArgumentError, "invalid value for 'carrier_id' when calling CarriersApi.list_carrier_package_types, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/carriers/{carrier_id}/packages'.sub('{' + 'carrier_id' + '}', CGI.escape(carrier_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] || 'ListCarrierPackageTypesResponseBody' # 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: CarriersApi#list_carrier_package_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List Carrier
Services List the services associated with the carrier ID @param carrier_id [String] Carrier
ID @param [Hash] opts the optional parameters @return [ListCarrierServicesResponseBody]
# File lib/ship_engine/api/carriers_api.rb, line 335 def list_carrier_services(carrier_id, opts = {}) data, _status_code, _headers = list_carrier_services_with_http_info(carrier_id, opts) data end
List Carrier
Services List the services associated with the carrier ID @param carrier_id [String] Carrier
ID @param [Hash] opts the optional parameters @return [Array<(ListCarrierServicesResponseBody
, Integer, Hash)>] ListCarrierServicesResponseBody
data, response status code and response headers
# File lib/ship_engine/api/carriers_api.rb, line 345 def list_carrier_services_with_http_info(carrier_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CarriersApi.list_carrier_services ...' end # verify the required parameter 'carrier_id' is set if @api_client.config.client_side_validation && carrier_id.nil? fail ArgumentError, "Missing the required parameter 'carrier_id' when calling CarriersApi.list_carrier_services" end if @api_client.config.client_side_validation && carrier_id.to_s.length > 25 fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.list_carrier_services, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && carrier_id.to_s.length < 1 fail ArgumentError, 'invalid value for "carrier_id" when calling CarriersApi.list_carrier_services, 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 && carrier_id !~ pattern fail ArgumentError, "invalid value for 'carrier_id' when calling CarriersApi.list_carrier_services, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/carriers/{carrier_id}/services'.sub('{' + 'carrier_id' + '}', CGI.escape(carrier_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] || 'ListCarrierServicesResponseBody' # 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: CarriersApi#list_carrier_services\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List Carriers List all carriers that have been added to this account @param [Hash] opts the optional parameters @return [GetCarriersResponseBody]
# File lib/ship_engine/api/carriers_api.rb, line 409 def list_carriers(opts = {}) data, _status_code, _headers = list_carriers_with_http_info(opts) data end
List Carriers List all carriers that have been added to this account @param [Hash] opts the optional parameters @return [Array<(GetCarriersResponseBody
, Integer, Hash)>] GetCarriersResponseBody
data, response status code and response headers
# File lib/ship_engine/api/carriers_api.rb, line 418 def list_carriers_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CarriersApi.list_carriers ...' end # resource path local_var_path = '/v1/carriers' # 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] || 'GetCarriersResponseBody' # 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: CarriersApi#list_carriers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end