class OpenapiClient::LabelsApi
Attributes
Public Class Methods
# File lib/openapi_client/api/labels_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Purchase Label
Purchase and print a label for shipment @param create_label_request_body [CreateLabelRequestBody] @param [Hash] opts the optional parameters @return [CreateLabelResponseBody]
# File lib/openapi_client/api/labels_api.rb, line 27 def create_label(create_label_request_body, opts = {}) data, _status_code, _headers = create_label_with_http_info(create_label_request_body, opts) data end
Purchase Label
with Rate
ID When retrieving rates for shipments using the `/rates` endpoint, the returned information contains a `rate_id` property that can be used to generate a label without having to refill in the shipment information repeatedly. @param rate_id [String] Rate
ID @param create_label_from_rate_request_body [CreateLabelFromRateRequestBody] @param [Hash] opts the optional parameters @return [CreateLabelFromRateResponseBody]
# File lib/openapi_client/api/labels_api.rb, line 92 def create_label_from_rate(rate_id, create_label_from_rate_request_body, opts = {}) data, _status_code, _headers = create_label_from_rate_with_http_info(rate_id, create_label_from_rate_request_body, opts) data end
Purchase Label
with Rate
ID When retrieving rates for shipments using the `/rates` endpoint, the returned information contains a `rate_id` property that can be used to generate a label without having to refill in the shipment information repeatedly. @param rate_id [String] Rate
ID @param create_label_from_rate_request_body [CreateLabelFromRateRequestBody] @param [Hash] opts the optional parameters @return [Array<(CreateLabelFromRateResponseBody
, Integer, Hash)>] CreateLabelFromRateResponseBody
data, response status code and response headers
# File lib/openapi_client/api/labels_api.rb, line 103 def create_label_from_rate_with_http_info(rate_id, create_label_from_rate_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.create_label_from_rate ...' 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 LabelsApi.create_label_from_rate" end if @api_client.config.client_side_validation && rate_id.to_s.length > 25 fail ArgumentError, 'invalid value for "rate_id" when calling LabelsApi.create_label_from_rate, 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 LabelsApi.create_label_from_rate, 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 LabelsApi.create_label_from_rate, must conform to the pattern #{pattern}." end # verify the required parameter 'create_label_from_rate_request_body' is set if @api_client.config.client_side_validation && create_label_from_rate_request_body.nil? fail ArgumentError, "Missing the required parameter 'create_label_from_rate_request_body' when calling LabelsApi.create_label_from_rate" end # resource path local_var_path = '/v1/labels/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']) # 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_label_from_rate_request_body) # return_type return_type = opts[:return_type] || 'CreateLabelFromRateResponseBody' # 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: LabelsApi#create_label_from_rate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Purchase Label
with Shipment
ID Purchase a label using a shipment ID that has already been created with the desired address and package info. @param shipment_id [String] Shipment
ID @param create_label_from_shipment_request_body [CreateLabelFromShipmentRequestBody] @param [Hash] opts the optional parameters @return [CreateLabelFromShipmentResponseBody]
# File lib/openapi_client/api/labels_api.rb, line 175 def create_label_from_shipment(shipment_id, create_label_from_shipment_request_body, opts = {}) data, _status_code, _headers = create_label_from_shipment_with_http_info(shipment_id, create_label_from_shipment_request_body, opts) data end
Purchase Label
with Shipment
ID Purchase a label using a shipment ID that has already been created with the desired address and package info. @param shipment_id [String] Shipment
ID @param create_label_from_shipment_request_body [CreateLabelFromShipmentRequestBody] @param [Hash] opts the optional parameters @return [Array<(CreateLabelFromShipmentResponseBody
, Integer, Hash)>] CreateLabelFromShipmentResponseBody
data, response status code and response headers
# File lib/openapi_client/api/labels_api.rb, line 186 def create_label_from_shipment_with_http_info(shipment_id, create_label_from_shipment_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.create_label_from_shipment ...' end # verify the required parameter 'shipment_id' is set if @api_client.config.client_side_validation && shipment_id.nil? fail ArgumentError, "Missing the required parameter 'shipment_id' when calling LabelsApi.create_label_from_shipment" end if @api_client.config.client_side_validation && shipment_id.to_s.length > 25 fail ArgumentError, 'invalid value for "shipment_id" when calling LabelsApi.create_label_from_shipment, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && shipment_id.to_s.length < 1 fail ArgumentError, 'invalid value for "shipment_id" when calling LabelsApi.create_label_from_shipment, 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 && shipment_id !~ pattern fail ArgumentError, "invalid value for 'shipment_id' when calling LabelsApi.create_label_from_shipment, must conform to the pattern #{pattern}." end # verify the required parameter 'create_label_from_shipment_request_body' is set if @api_client.config.client_side_validation && create_label_from_shipment_request_body.nil? fail ArgumentError, "Missing the required parameter 'create_label_from_shipment_request_body' when calling LabelsApi.create_label_from_shipment" end # resource path local_var_path = '/v1/labels/shipment/{shipment_id}'.sub('{' + 'shipment_id' + '}', CGI.escape(shipment_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(create_label_from_shipment_request_body) # return_type return_type = opts[:return_type] || 'CreateLabelFromShipmentResponseBody' # 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: LabelsApi#create_label_from_shipment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Purchase Label
Purchase and print a label for shipment @param create_label_request_body [CreateLabelRequestBody] @param [Hash] opts the optional parameters @return [Array<(CreateLabelResponseBody
, Integer, Hash)>] CreateLabelResponseBody
data, response status code and response headers
# File lib/openapi_client/api/labels_api.rb, line 37 def create_label_with_http_info(create_label_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.create_label ...' end # verify the required parameter 'create_label_request_body' is set if @api_client.config.client_side_validation && create_label_request_body.nil? fail ArgumentError, "Missing the required parameter 'create_label_request_body' when calling LabelsApi.create_label" end # resource path local_var_path = '/v1/labels' # 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_label_request_body) # return_type return_type = opts[:return_type] || 'CreateLabelResponseBody' # 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: LabelsApi#create_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Create a return label Create a return label @param label_id [String] Label
ID @param create_return_label_request_body [CreateReturnLabelRequestBody] @param [Hash] opts the optional parameters @return [CreateReturnLabelResponseBody]
# File lib/openapi_client/api/labels_api.rb, line 258 def create_return_label(label_id, create_return_label_request_body, opts = {}) data, _status_code, _headers = create_return_label_with_http_info(label_id, create_return_label_request_body, opts) data end
Create a return label Create a return label @param label_id [String] Label
ID @param create_return_label_request_body [CreateReturnLabelRequestBody] @param [Hash] opts the optional parameters @return [Array<(CreateReturnLabelResponseBody
, Integer, Hash)>] CreateReturnLabelResponseBody
data, response status code and response headers
# File lib/openapi_client/api/labels_api.rb, line 269 def create_return_label_with_http_info(label_id, create_return_label_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.create_return_label ...' end # verify the required parameter 'label_id' is set if @api_client.config.client_side_validation && label_id.nil? fail ArgumentError, "Missing the required parameter 'label_id' when calling LabelsApi.create_return_label" end if @api_client.config.client_side_validation && label_id.to_s.length > 25 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.create_return_label, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && label_id.to_s.length < 1 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.create_return_label, 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 && label_id !~ pattern fail ArgumentError, "invalid value for 'label_id' when calling LabelsApi.create_return_label, must conform to the pattern #{pattern}." end # verify the required parameter 'create_return_label_request_body' is set if @api_client.config.client_side_validation && create_return_label_request_body.nil? fail ArgumentError, "Missing the required parameter 'create_return_label_request_body' when calling LabelsApi.create_return_label" end # resource path local_var_path = '/v1/labels/{label_id}/return'.sub('{' + 'label_id' + '}', CGI.escape(label_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(create_return_label_request_body) # return_type return_type = opts[:return_type] || 'CreateReturnLabelResponseBody' # 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: LabelsApi#create_return_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Label
By External Shipment
ID Find a label by using the external shipment id that was used during label creation @param external_shipment_id [String] @param [Hash] opts the optional parameters @option opts [LabelDownloadType] :label_download_type @return [GetLabelByExternalShipmentIdResponseBody]
# File lib/openapi_client/api/labels_api.rb, line 341 def get_label_by_external_shipment_id(external_shipment_id, opts = {}) data, _status_code, _headers = get_label_by_external_shipment_id_with_http_info(external_shipment_id, opts) data end
Get Label
By External Shipment
ID Find a label by using the external shipment id that was used during label creation @param external_shipment_id [String] @param [Hash] opts the optional parameters @option opts [LabelDownloadType] :label_download_type @return [Array<(GetLabelByExternalShipmentIdResponseBody
, Integer, Hash)>] GetLabelByExternalShipmentIdResponseBody
data, response status code and response headers
# File lib/openapi_client/api/labels_api.rb, line 352 def get_label_by_external_shipment_id_with_http_info(external_shipment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.get_label_by_external_shipment_id ...' end # verify the required parameter 'external_shipment_id' is set if @api_client.config.client_side_validation && external_shipment_id.nil? fail ArgumentError, "Missing the required parameter 'external_shipment_id' when calling LabelsApi.get_label_by_external_shipment_id" end # resource path local_var_path = '/v1/labels/external_shipment_id/{external_shipment_id}'.sub('{' + 'external_shipment_id' + '}', CGI.escape(external_shipment_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'label_download_type'] = opts[:'label_download_type'] if !opts[:'label_download_type'].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] || 'GetLabelByExternalShipmentIdResponseBody' # 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: LabelsApi#get_label_by_external_shipment_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Label
By ID Retrieve information for individual labels. @param label_id [String] Label
ID @param [Hash] opts the optional parameters @option opts [LabelDownloadType] :label_download_type @return [GetLabelByIdResponseBody]
# File lib/openapi_client/api/labels_api.rb, line 406 def get_label_by_id(label_id, opts = {}) data, _status_code, _headers = get_label_by_id_with_http_info(label_id, opts) data end
Get Label
By ID Retrieve information for individual labels. @param label_id [String] Label
ID @param [Hash] opts the optional parameters @option opts [LabelDownloadType] :label_download_type @return [Array<(GetLabelByIdResponseBody
, Integer, Hash)>] GetLabelByIdResponseBody
data, response status code and response headers
# File lib/openapi_client/api/labels_api.rb, line 417 def get_label_by_id_with_http_info(label_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.get_label_by_id ...' end # verify the required parameter 'label_id' is set if @api_client.config.client_side_validation && label_id.nil? fail ArgumentError, "Missing the required parameter 'label_id' when calling LabelsApi.get_label_by_id" end if @api_client.config.client_side_validation && label_id.to_s.length > 25 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.get_label_by_id, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && label_id.to_s.length < 1 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.get_label_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 && label_id !~ pattern fail ArgumentError, "invalid value for 'label_id' when calling LabelsApi.get_label_by_id, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/labels/{label_id}'.sub('{' + 'label_id' + '}', CGI.escape(label_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'label_download_type'] = opts[:'label_download_type'] if !opts[:'label_download_type'].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] || 'GetLabelByIdResponseBody' # 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: LabelsApi#get_label_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get Label
Tracking Information Retrieve the label's tracking information @param label_id [String] Label
ID @param [Hash] opts the optional parameters @return [GetTrackingLogFromLabelResponseBody]
# File lib/openapi_client/api/labels_api.rb, line 483 def get_tracking_log_from_label(label_id, opts = {}) data, _status_code, _headers = get_tracking_log_from_label_with_http_info(label_id, opts) data end
Get Label
Tracking Information Retrieve the label's tracking information @param label_id [String] Label
ID @param [Hash] opts the optional parameters @return [Array<(GetTrackingLogFromLabelResponseBody
, Integer, Hash)>] GetTrackingLogFromLabelResponseBody
data, response status code and response headers
# File lib/openapi_client/api/labels_api.rb, line 493 def get_tracking_log_from_label_with_http_info(label_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.get_tracking_log_from_label ...' end # verify the required parameter 'label_id' is set if @api_client.config.client_side_validation && label_id.nil? fail ArgumentError, "Missing the required parameter 'label_id' when calling LabelsApi.get_tracking_log_from_label" end if @api_client.config.client_side_validation && label_id.to_s.length > 25 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.get_tracking_log_from_label, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && label_id.to_s.length < 1 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.get_tracking_log_from_label, 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 && label_id !~ pattern fail ArgumentError, "invalid value for 'label_id' when calling LabelsApi.get_tracking_log_from_label, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/labels/{label_id}/track'.sub('{' + 'label_id' + '}', CGI.escape(label_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] || 'GetTrackingLogFromLabelResponseBody' # 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: LabelsApi#get_tracking_log_from_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
List labels This endpoint returns a list of labels that you've [created](www.shipengine.com/docs/labels/create-a-label/). You can optionally filter the results as well as control their sort order and the number of results returned at a time. By default, all labels are returned, 25 at a time, starting with the most recently created ones. You can combine multiple filter options to narrow-down the results. For example, if you only want to get your UPS labels for your east coast warehouse you could query by both `warehouse_id` and `carrier_id` @param [Hash] opts the optional parameters @option opts [LabelStatus] :label_status Only return labels that are currently in the specified status @option opts [String] :service_code Only return labels for a specific [carrier service](www.shipengine.com/docs/shipping/use-a-carrier-service/) @option opts [String] :carrier_id Only return labels for a specific [carrier account](www.shipengine.com/docs/carriers/setup/) @option opts [String] :tracking_number Only return labels with a specific tracking number @option opts [String] :batch_id Only return labels that were created in a specific [batch](www.shipengine.com/docs/labels/bulk/) @option opts [String] :rate_id Rate
ID @option opts [String] :shipment_id Shipment
ID @option opts [String] :warehouse_id Only return labels that originate from a specific [warehouse](www.shipengine.com/docs/shipping/ship-from-a-warehouse/) @option opts [DateTime] :created_at_start Only return labels that were created on or after a specific date/time @option opts [DateTime] :created_at_end Only return labels that were created on or before a specific date/time @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 [SortDir] :sort_dir Controls the sort order of the query. @option opts [String] :sort_by Controls which field the query is sorted by. (default to 'created_at') @return [ListLabelsResponseBody]
# File lib/openapi_client/api/labels_api.rb, line 571 def list_labels(opts = {}) data, _status_code, _headers = list_labels_with_http_info(opts) data end
List labels This endpoint returns a list of labels that you've [created](www.shipengine.com/docs/labels/create-a-label/). You can optionally filter the results as well as control their sort order and the number of results returned at a time. By default, all labels are returned, 25 at a time, starting with the most recently created ones. You can combine multiple filter options to narrow-down the results. For example, if you only want to get your UPS labels for your east coast warehouse you could query by both `warehouse_id` and `carrier_id` @param [Hash] opts the optional parameters @option opts [LabelStatus] :label_status Only return labels that are currently in the specified status @option opts [String] :service_code Only return labels for a specific [carrier service](www.shipengine.com/docs/shipping/use-a-carrier-service/) @option opts [String] :carrier_id Only return labels for a specific [carrier account](www.shipengine.com/docs/carriers/setup/) @option opts [String] :tracking_number Only return labels with a specific tracking number @option opts [String] :batch_id Only return labels that were created in a specific [batch](www.shipengine.com/docs/labels/bulk/) @option opts [String] :rate_id Rate
ID @option opts [String] :shipment_id Shipment
ID @option opts [String] :warehouse_id Only return labels that originate from a specific [warehouse](www.shipengine.com/docs/shipping/ship-from-a-warehouse/) @option opts [DateTime] :created_at_start Only return labels that were created on or after a specific date/time @option opts [DateTime] :created_at_end Only return labels that were created on or before a specific date/time @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 [SortDir] :sort_dir Controls the sort order of the query. @option opts [String] :sort_by Controls which field the query is sorted by. @return [Array<(ListLabelsResponseBody
, Integer, Hash)>] ListLabelsResponseBody
data, response status code and response headers
# File lib/openapi_client/api/labels_api.rb, line 594 def list_labels_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.list_labels ...' end pattern = Regexp.new(/^[a-z0-9]+(_[a-z0-9-]+)* ?$/) if @api_client.config.client_side_validation && !opts[:'service_code'].nil? && opts[:'service_code'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"service_code\"]' when calling LabelsApi.list_labels, 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 LabelsApi.list_labels, 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 LabelsApi.list_labels, 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 LabelsApi.list_labels, must conform to the pattern #{pattern}." end if @api_client.config.client_side_validation && !opts[:'tracking_number'].nil? && opts[:'tracking_number'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"tracking_number"]" when calling LabelsApi.list_labels, the character length must be great than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'batch_id'].nil? && opts[:'batch_id'].to_s.length > 25 fail ArgumentError, 'invalid value for "opts[:"batch_id"]" when calling LabelsApi.list_labels, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && !opts[:'batch_id'].nil? && opts[:'batch_id'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"batch_id"]" when calling LabelsApi.list_labels, 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[:'batch_id'].nil? && opts[:'batch_id'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"batch_id\"]' when calling LabelsApi.list_labels, must conform to the pattern #{pattern}." end if @api_client.config.client_side_validation && !opts[:'rate_id'].nil? && opts[:'rate_id'].to_s.length > 25 fail ArgumentError, 'invalid value for "opts[:"rate_id"]" when calling LabelsApi.list_labels, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && !opts[:'rate_id'].nil? && opts[:'rate_id'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"rate_id"]" when calling LabelsApi.list_labels, 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[:'rate_id'].nil? && opts[:'rate_id'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"rate_id\"]' when calling LabelsApi.list_labels, must conform to the pattern #{pattern}." end if @api_client.config.client_side_validation && !opts[:'shipment_id'].nil? && opts[:'shipment_id'].to_s.length > 25 fail ArgumentError, 'invalid value for "opts[:"shipment_id"]" when calling LabelsApi.list_labels, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && !opts[:'shipment_id'].nil? && opts[:'shipment_id'].to_s.length < 1 fail ArgumentError, 'invalid value for "opts[:"shipment_id"]" when calling LabelsApi.list_labels, 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[:'shipment_id'].nil? && opts[:'shipment_id'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"shipment_id\"]' when calling LabelsApi.list_labels, must conform to the pattern #{pattern}." 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 LabelsApi.list_labels, 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 LabelsApi.list_labels, 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 LabelsApi.list_labels, 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 LabelsApi.list_labels, 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 LabelsApi.list_labels, must be greater than or equal to 1.' end allowable_values = ["modified_at", "created_at"] if @api_client.config.client_side_validation && opts[:'sort_by'] && !allowable_values.include?(opts[:'sort_by']) fail ArgumentError, "invalid value for \"sort_by\", must be one of #{allowable_values}" end # resource path local_var_path = '/v1/labels' # query parameters query_params = opts[:query_params] || {} query_params[:'label_status'] = opts[:'label_status'] if !opts[:'label_status'].nil? query_params[:'service_code'] = opts[:'service_code'] if !opts[:'service_code'].nil? query_params[:'carrier_id'] = opts[:'carrier_id'] if !opts[:'carrier_id'].nil? query_params[:'tracking_number'] = opts[:'tracking_number'] if !opts[:'tracking_number'].nil? query_params[:'batch_id'] = opts[:'batch_id'] if !opts[:'batch_id'].nil? query_params[:'rate_id'] = opts[:'rate_id'] if !opts[:'rate_id'].nil? query_params[:'shipment_id'] = opts[:'shipment_id'] if !opts[:'shipment_id'].nil? query_params[:'warehouse_id'] = opts[:'warehouse_id'] if !opts[:'warehouse_id'].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[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'sort_dir'] = opts[:'sort_dir'] if !opts[:'sort_dir'].nil? query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].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] || 'ListLabelsResponseBody' # 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: LabelsApi#list_labels\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Void a Label
By ID Void a label by ID to get a refund. @param label_id [String] Label
ID @param [Hash] opts the optional parameters @return [VoidLabelResponseBody]
# File lib/openapi_client/api/labels_api.rb, line 742 def void_label(label_id, opts = {}) data, _status_code, _headers = void_label_with_http_info(label_id, opts) data end
Void a Label
By ID Void a label by ID to get a refund. @param label_id [String] Label
ID @param [Hash] opts the optional parameters @return [Array<(VoidLabelResponseBody
, Integer, Hash)>] VoidLabelResponseBody
data, response status code and response headers
# File lib/openapi_client/api/labels_api.rb, line 752 def void_label_with_http_info(label_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LabelsApi.void_label ...' end # verify the required parameter 'label_id' is set if @api_client.config.client_side_validation && label_id.nil? fail ArgumentError, "Missing the required parameter 'label_id' when calling LabelsApi.void_label" end if @api_client.config.client_side_validation && label_id.to_s.length > 25 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.void_label, the character length must be smaller than or equal to 25.' end if @api_client.config.client_side_validation && label_id.to_s.length < 1 fail ArgumentError, 'invalid value for "label_id" when calling LabelsApi.void_label, 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 && label_id !~ pattern fail ArgumentError, "invalid value for 'label_id' when calling LabelsApi.void_label, must conform to the pattern #{pattern}." end # resource path local_var_path = '/v1/labels/{label_id}/void'.sub('{' + 'label_id' + '}', CGI.escape(label_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] || 'VoidLabelResponseBody' # 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: LabelsApi#void_label\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end