class ShipEngine::ManifestsApi
Attributes
Public Class Methods
# File lib/ship_engine/api/manifests_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Create Manifest
Each ShipEngine
manifest is created for a specific warehouse, so you'll need to provide the warehouse_id rather than the ship_from address. You can create a warehouse for each location that you want to create manifests for. @param create_manifest_request_body [CreateManifestRequestBody] @param [Hash] opts the optional parameters @return [CreateManifestResponseBody]
# File lib/ship_engine/api/manifests_api.rb, line 27 def create_manifest(create_manifest_request_body, opts = {}) data, _status_code, _headers = create_manifest_with_http_info(create_manifest_request_body, opts) data end
Create Manifest
Each ShipEngine
manifest is created for a specific warehouse, so you'll need to provide the warehouse_id rather than the ship_from address. You can create a warehouse for each location that you want to create manifests for. @param create_manifest_request_body [CreateManifestRequestBody] @param [Hash] opts the optional parameters @return [Array<(CreateManifestResponseBody
, Integer, Hash)>] CreateManifestResponseBody
data, response status code and response headers
# File lib/ship_engine/api/manifests_api.rb, line 37 def create_manifest_with_http_info(create_manifest_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManifestsApi.create_manifest ...' end # verify the required parameter 'create_manifest_request_body' is set if @api_client.config.client_side_validation && create_manifest_request_body.nil? fail ArgumentError, "Missing the required parameter 'create_manifest_request_body' when calling ManifestsApi.create_manifest" end # resource path local_var_path = '/v1/manifests' # 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(create_manifest_request_body) # return_type return_type = opts[:return_type] || 'CreateManifestResponseBody' # 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: ManifestsApi#create_manifest\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Manifest
By Id Get Manifest
By Id @param manifest_id [String] The Manifest
Id @param [Hash] opts the optional parameters @return [GetManifestByIdResponseBody]
# File lib/ship_engine/api/manifests_api.rb, line 91 def get_manifest_by_id(manifest_id, opts = {}) data, _status_code, _headers = get_manifest_by_id_with_http_info(manifest_id, opts) data end
Get Manifest
By Id Get Manifest
By Id @param manifest_id [String] The Manifest
Id @param [Hash] opts the optional parameters @return [Array<(GetManifestByIdResponseBody
, Integer, Hash)>] GetManifestByIdResponseBody
data, response status code and response headers
# File lib/ship_engine/api/manifests_api.rb, line 101 def get_manifest_by_id_with_http_info(manifest_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManifestsApi.get_manifest_by_id ...' end # verify the required parameter 'manifest_id' is set if @api_client.config.client_side_validation && manifest_id.nil? fail ArgumentError, "Missing the required parameter 'manifest_id' when calling ManifestsApi.get_manifest_by_id" end if @api_client.config.client_side_validation && manifest_id.to_s.length > 25 fail ArgumentError, 'invalid value for "manifest_id" when calling ManifestsApi.get_manifest_by_id, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && manifest_id.to_s.length < 1 fail ArgumentError, 'invalid value for "manifest_id" when calling ManifestsApi.get_manifest_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 && manifest_id !~ pattern fail ArgumentError, "invalid value for 'manifest_id' when calling ManifestsApi.get_manifest_by_id, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/manifests/{manifest_id}'.sub('{' + 'manifest_id' + '}', CGI.escape(manifest_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] || 'GetManifestByIdResponseBody' # 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: ManifestsApi#get_manifest_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List Manifests
Similar to querying shipments, we allow you to query manifests since there will likely be a large number over a long period of time. @param [Hash] opts the optional parameters @option opts [String] :warehouse_id Warehouse
ID @option opts [DateTime] :ship_date_start ship date start range @option opts [DateTime] :ship_date_end ship date end range @option opts [DateTime] :created_at_start Used to create a filter for when a resource was created (ex. A shipment that was created after a certain time) @option opts [DateTime] :created_at_end Used to create a filter for when a resource was created, (ex. A shipment that was created before a certain time) @option opts [String] :carrier_id Carrier
ID @option opts [Integer] :page Return a specific page of results. Defaults to the first page. If set to a number that's greater than the number of pages of results, an empty page is returned. (default to 1) @option opts [Integer] :page_size The number of results to return per response. (default to 25) @option opts [Array<String>] :label_ids @return [ListManifestsResponseBody]
# File lib/ship_engine/api/manifests_api.rb, line 174 def list_manifests(opts = {}) data, _status_code, _headers = list_manifests_with_http_info(opts) data end
List Manifests
Similar to querying shipments, we allow you to query manifests since there will likely be a large number over a long period of time. @param [Hash] opts the optional parameters @option opts [String] :warehouse_id Warehouse
ID @option opts [DateTime] :ship_date_start ship date start range @option opts [DateTime] :ship_date_end ship date end range @option opts [DateTime] :created_at_start Used to create a filter for when a resource was created (ex. A shipment that was created after a certain time) @option opts [DateTime] :created_at_end Used to create a filter for when a resource was created, (ex. A shipment that was created before a certain time) @option opts [String] :carrier_id Carrier
ID @option opts [Integer] :page Return a specific page of results. Defaults to the first page. If set to a number that's greater than the number of pages of results, an empty page is returned. @option opts [Integer] :page_size The number of results to return per response. @option opts [Array<String>] :label_ids @return [Array<(ListManifestsResponseBody
, Integer, Hash)>] ListManifestsResponseBody
data, response status code and response headers
# File lib/ship_engine/api/manifests_api.rb, line 192 def list_manifests_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManifestsApi.list_manifests ...' end if @api_client.config.client_side_validation && !opts[:'warehouse_id'].nil? && opts[:'warehouse_id'].to_s.length > 25 fail ArgumentError, 'invalid value for "opts[:"warehouse_id"]" when calling ManifestsApi.list_manifests, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && !opts[:'warehouse_id'].nil? && opts[:'warehouse_id'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"warehouse_id"]" when calling ManifestsApi.list_manifests, 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 && !opts[:'warehouse_id'].nil? && opts[:'warehouse_id'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"warehouse_id\"]' when calling ManifestsApi.list_manifests, must conform to the pattern #{pattern}." end if @api_client.config.client_side_validation && !opts[:'carrier_id'].nil? && opts[:'carrier_id'].to_s.length > 25 fail ArgumentError, 'invalid value for "opts[:"carrier_id"]" when calling ManifestsApi.list_manifests, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && !opts[:'carrier_id'].nil? && opts[:'carrier_id'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"carrier_id"]" when calling ManifestsApi.list_manifests, 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 && !opts[:'carrier_id'].nil? && opts[:'carrier_id'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"carrier_id\"]' when calling ManifestsApi.list_manifests, must conform to the pattern #{pattern}." end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ManifestsApi.list_manifests, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManifestsApi.list_manifests, must be greater than or equal to 1.' end # resource path local_var_path = '/v1/manifests' # query parameters query_params = opts[:query_params] || {} query_params[:'warehouse_id'] = opts[:'warehouse_id'] if !opts[:'warehouse_id'].nil? query_params[:'ship_date_start'] = opts[:'ship_date_start'] if !opts[:'ship_date_start'].nil? query_params[:'ship_date_end'] = opts[:'ship_date_end'] if !opts[:'ship_date_end'].nil? query_params[:'created_at_start'] = opts[:'created_at_start'] if !opts[:'created_at_start'].nil? query_params[:'created_at_end'] = opts[:'created_at_end'] if !opts[:'created_at_end'].nil? query_params[:'carrier_id'] = opts[:'carrier_id'] if !opts[:'carrier_id'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'label_ids'] = @api_client.build_collection_param(opts[:'label_ids'], :multi) if !opts[:'label_ids'].nil? # 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] || 'ListManifestsResponseBody' # 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: ManifestsApi#list_manifests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end