class OpenapiClient::ShipmentsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/openapi_client/api/shipments_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

cancel_shipments(shipment_id, opts = {}) click to toggle source

Cancel a Shipment Mark a shipment cancelled, if it is no longer needed or being used by your organized. Any label associated with the shipment needs to be voided first An example use case would be if a batch label creation job is going to run at a set time and only queries `pending` shipments. Marking a shipment as cancelled would remove it from this process @param shipment_id [String] Shipment ID @param [Hash] opts the optional parameters @return [String]

# File lib/openapi_client/api/shipments_api.rb, line 27
def cancel_shipments(shipment_id, opts = {})
  data, _status_code, _headers = cancel_shipments_with_http_info(shipment_id, opts)
  data
end
cancel_shipments_with_http_info(shipment_id, opts = {}) click to toggle source

Cancel a Shipment Mark a shipment cancelled, if it is no longer needed or being used by your organized. Any label associated with the shipment needs to be voided first An example use case would be if a batch label creation job is going to run at a set time and only queries &#x60;pending&#x60; shipments. Marking a shipment as cancelled would remove it from this process @param shipment_id [String] Shipment ID @param [Hash] opts the optional parameters @return [Array<(String, Integer, Hash)>] String data, response status code and response headers

# File lib/openapi_client/api/shipments_api.rb, line 37
def cancel_shipments_with_http_info(shipment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ShipmentsApi.cancel_shipments ...'
  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 ShipmentsApi.cancel_shipments"
  end
  if @api_client.config.client_side_validation && shipment_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "shipment_id" when calling ShipmentsApi.cancel_shipments, 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 ShipmentsApi.cancel_shipments, 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 ShipmentsApi.cancel_shipments, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/shipments/{shipment_id}/cancel'.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(['text/plain', 'application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'String' 

  # 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: ShipmentsApi#cancel_shipments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
create_shipments(create_shipments_request_body, opts = {}) click to toggle source

Create Shipments Create one or multiple shipments. @param create_shipments_request_body [CreateShipmentsRequestBody] @param [Hash] opts the optional parameters @return [CreateShipmentsResponseBody]

# File lib/openapi_client/api/shipments_api.rb, line 102
def create_shipments(create_shipments_request_body, opts = {})
  data, _status_code, _headers = create_shipments_with_http_info(create_shipments_request_body, opts)
  data
end
create_shipments_with_http_info(create_shipments_request_body, opts = {}) click to toggle source

Create Shipments Create one or multiple shipments. @param create_shipments_request_body [CreateShipmentsRequestBody] @param [Hash] opts the optional parameters @return [Array<(CreateShipmentsResponseBody, Integer, Hash)>] CreateShipmentsResponseBody data, response status code and response headers

# File lib/openapi_client/api/shipments_api.rb, line 112
def create_shipments_with_http_info(create_shipments_request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ShipmentsApi.create_shipments ...'
  end
  # verify the required parameter 'create_shipments_request_body' is set
  if @api_client.config.client_side_validation && create_shipments_request_body.nil?
    fail ArgumentError, "Missing the required parameter 'create_shipments_request_body' when calling ShipmentsApi.create_shipments"
  end
  # resource path
  local_var_path = '/v1/shipments'

  # 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_shipments_request_body) 

  # return_type
  return_type = opts[:return_type] || 'CreateShipmentsResponseBody' 

  # 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: ShipmentsApi#create_shipments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_shipment_by_external_id(external_shipment_id, opts = {}) click to toggle source

Get Shipment By External ID Query Shipments created using your own custom ID convention using this endpint @param external_shipment_id [String] @param [Hash] opts the optional parameters @return [GetShipmentByExternalIdResponseBody]

# File lib/openapi_client/api/shipments_api.rb, line 166
def get_shipment_by_external_id(external_shipment_id, opts = {})
  data, _status_code, _headers = get_shipment_by_external_id_with_http_info(external_shipment_id, opts)
  data
end
get_shipment_by_external_id_with_http_info(external_shipment_id, opts = {}) click to toggle source

Get Shipment By External ID Query Shipments created using your own custom ID convention using this endpint @param external_shipment_id [String] @param [Hash] opts the optional parameters @return [Array<(GetShipmentByExternalIdResponseBody, Integer, Hash)>] GetShipmentByExternalIdResponseBody data, response status code and response headers

# File lib/openapi_client/api/shipments_api.rb, line 176
def get_shipment_by_external_id_with_http_info(external_shipment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ShipmentsApi.get_shipment_by_external_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 ShipmentsApi.get_shipment_by_external_id"
  end
  # resource path
  local_var_path = '/v1/shipments/external_shipment_id/{external_shipment_id}'.sub('{' + 'external_shipment_id' + '}', CGI.escape(external_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'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'GetShipmentByExternalIdResponseBody' 

  # 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: ShipmentsApi#get_shipment_by_external_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_shipment_by_id(shipment_id, opts = {}) click to toggle source

Get Shipment By ID Get an individual shipment based on its ID @param shipment_id [String] Shipment ID @param [Hash] opts the optional parameters @return [GetShipmentByIdResponseBody]

# File lib/openapi_client/api/shipments_api.rb, line 228
def get_shipment_by_id(shipment_id, opts = {})
  data, _status_code, _headers = get_shipment_by_id_with_http_info(shipment_id, opts)
  data
end
get_shipment_by_id_with_http_info(shipment_id, opts = {}) click to toggle source

Get Shipment By ID Get an individual shipment based on its ID @param shipment_id [String] Shipment ID @param [Hash] opts the optional parameters @return [Array<(GetShipmentByIdResponseBody, Integer, Hash)>] GetShipmentByIdResponseBody data, response status code and response headers

# File lib/openapi_client/api/shipments_api.rb, line 238
def get_shipment_by_id_with_http_info(shipment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ShipmentsApi.get_shipment_by_id ...'
  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 ShipmentsApi.get_shipment_by_id"
  end
  if @api_client.config.client_side_validation && shipment_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "shipment_id" when calling ShipmentsApi.get_shipment_by_id, 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 ShipmentsApi.get_shipment_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 && shipment_id !~ pattern
    fail ArgumentError, "invalid value for 'shipment_id' when calling ShipmentsApi.get_shipment_by_id, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/shipments/{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'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'GetShipmentByIdResponseBody' 

  # 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: ShipmentsApi#get_shipment_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_shipment_errors(shipment_id, opts = {}) click to toggle source

Get Shipment Errors If there are no errors associated with this shipment then the API will return a 404 Not Found response to indicate that no errors are associated with the request @param shipment_id [String] Shipment ID @param [Hash] opts the optional parameters @option opts [Integer] :page Return a specific page of results. Defaults to the first page. If set to a number that&#39;s greater than the number of pages of results, an empty page is returned. (default to 1) @option opts [Integer] :pagesize @return [ListShipmentErrorsResponseBody]

# File lib/openapi_client/api/shipments_api.rb, line 305
def list_shipment_errors(shipment_id, opts = {})
  data, _status_code, _headers = list_shipment_errors_with_http_info(shipment_id, opts)
  data
end
list_shipment_errors_with_http_info(shipment_id, opts = {}) click to toggle source

Get Shipment Errors If there are no errors associated with this shipment then the API will return a 404 Not Found response to indicate that no errors are associated with the request @param shipment_id [String] Shipment ID @param [Hash] opts the optional parameters @option opts [Integer] :page Return a specific page of results. Defaults to the first page. If set to a number that&#39;s greater than the number of pages of results, an empty page is returned. @option opts [Integer] :pagesize @return [Array<(ListShipmentErrorsResponseBody, Integer, Hash)>] ListShipmentErrorsResponseBody data, response status code and response headers

# File lib/openapi_client/api/shipments_api.rb, line 317
def list_shipment_errors_with_http_info(shipment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ShipmentsApi.list_shipment_errors ...'
  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 ShipmentsApi.list_shipment_errors"
  end
  if @api_client.config.client_side_validation && shipment_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "shipment_id" when calling ShipmentsApi.list_shipment_errors, 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 ShipmentsApi.list_shipment_errors, 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 ShipmentsApi.list_shipment_errors, 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 ShipmentsApi.list_shipment_errors, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'pagesize'].nil? && opts[:'pagesize'] < 1
    fail ArgumentError, 'invalid value for "opts[:"pagesize"]" when calling ShipmentsApi.list_shipment_errors, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/shipments/{shipment_id}/errors'.sub('{' + 'shipment_id' + '}', CGI.escape(shipment_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'pagesize'] = opts[:'pagesize'] if !opts[:'pagesize'].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] || 'ListShipmentErrorsResponseBody' 

  # 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: ShipmentsApi#list_shipment_errors\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_shipment_rates(shipment_id, opts = {}) click to toggle source

Get Shipment Rates Get Rates for the shipment information associated with the shipment ID @param shipment_id [String] Shipment ID @param [Hash] opts the optional parameters @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) @return [ListShipmentRatesResponseBody]

# File lib/openapi_client/api/shipments_api.rb, line 393
def list_shipment_rates(shipment_id, opts = {})
  data, _status_code, _headers = list_shipment_rates_with_http_info(shipment_id, opts)
  data
end
list_shipment_rates_with_http_info(shipment_id, opts = {}) click to toggle source

Get Shipment Rates Get Rates for the shipment information associated with the shipment ID @param shipment_id [String] Shipment ID @param [Hash] opts the optional parameters @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) @return [Array<(ListShipmentRatesResponseBody, Integer, Hash)>] ListShipmentRatesResponseBody data, response status code and response headers

# File lib/openapi_client/api/shipments_api.rb, line 404
def list_shipment_rates_with_http_info(shipment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ShipmentsApi.list_shipment_rates ...'
  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 ShipmentsApi.list_shipment_rates"
  end
  if @api_client.config.client_side_validation && shipment_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "shipment_id" when calling ShipmentsApi.list_shipment_rates, 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 ShipmentsApi.list_shipment_rates, 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 ShipmentsApi.list_shipment_rates, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/shipments/{shipment_id}/rates'.sub('{' + 'shipment_id' + '}', CGI.escape(shipment_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'created_at_start'] = opts[:'created_at_start'] if !opts[:'created_at_start'].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] || 'ListShipmentRatesResponseBody' 

  # 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: ShipmentsApi#list_shipment_rates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_shipments(opts = {}) click to toggle source

List Shipments Get list of Shipments @param [Hash] opts the optional parameters @option opts [ShipmentStatus] :shipment_status @option opts [String] :batch_id Batch ID @option opts [String] :tag Search for shipments based on the custom tag added to the shipment object @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 [DateTime] :modified_at_start Used to create a filter for when a resource was modified (ex. A shipment that was modified after a certain time) @option opts [DateTime] :modified_at_end Used to create a filter for when a resource was modified (ex. A shipment that was modified before a certain time) @option opts [Integer] :page Return a specific page of results. Defaults to the first page. If set to a number that&#39;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 [String] :sales_order_id Sales Order ID @option opts [SortDir] :sort_dir Controls the sort order of the query. @option opts [ShipmentsSortBy] :sort_by @return [ListShipmentsResponseBody]

# File lib/openapi_client/api/shipments_api.rb, line 481
def list_shipments(opts = {})
  data, _status_code, _headers = list_shipments_with_http_info(opts)
  data
end
list_shipments_with_http_info(opts = {}) click to toggle source

List Shipments Get list of Shipments @param [Hash] opts the optional parameters @option opts [ShipmentStatus] :shipment_status @option opts [String] :batch_id Batch ID @option opts [String] :tag Search for shipments based on the custom tag added to the shipment object @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 [DateTime] :modified_at_start Used to create a filter for when a resource was modified (ex. A shipment that was modified after a certain time) @option opts [DateTime] :modified_at_end Used to create a filter for when a resource was modified (ex. A shipment that was modified before a certain time) @option opts [Integer] :page Return a specific page of results. Defaults to the first page. If set to a number that&#39;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 [String] :sales_order_id Sales Order ID @option opts [SortDir] :sort_dir Controls the sort order of the query. @option opts [ShipmentsSortBy] :sort_by @return [Array<(ListShipmentsResponseBody, Integer, Hash)>] ListShipmentsResponseBody data, response status code and response headers

# File lib/openapi_client/api/shipments_api.rb, line 502
def list_shipments_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ShipmentsApi.list_shipments ...'
  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 ShipmentsApi.list_shipments, 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 ShipmentsApi.list_shipments, 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 ShipmentsApi.list_shipments, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'tag'].nil? && opts[:'tag'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"tag"]" when calling ShipmentsApi.list_shipments, the character length must be great than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ShipmentsApi.list_shipments, 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 ShipmentsApi.list_shipments, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/shipments'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'shipment_status'] = opts[:'shipment_status'] if !opts[:'shipment_status'].nil?
  query_params[:'batch_id'] = opts[:'batch_id'] if !opts[:'batch_id'].nil?
  query_params[:'tag'] = opts[:'tag'] if !opts[:'tag'].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[:'modified_at_start'] = opts[:'modified_at_start'] if !opts[:'modified_at_start'].nil?
  query_params[:'modified_at_end'] = opts[:'modified_at_end'] if !opts[:'modified_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[:'sales_order_id'] = opts[:'sales_order_id'] if !opts[:'sales_order_id'].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] || 'ListShipmentsResponseBody' 

  # 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: ShipmentsApi#list_shipments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
parse_shipment(parse_shipment_request_body, opts = {}) click to toggle source

Parse shipping info The shipment-recognition API makes it easy for you to extract shipping data from unstructured text, including people's names, addresses, package weights and dimensions, insurance and delivery requirements, and more. Data often enters your system as unstructured text (for example: emails, SMS messages, support tickets, or other documents). ShipEngine's shipment-recognition API helps you extract meaningful, structured data from this unstructured text. The parsed shipment data is returned in the same structure that's used for other ShipEngine APIs, so you can easily use the parsed data to create a shipping label. > Note: Shipment recognition is currently supported for the United States, Canada, Australia, New Zealand, the United Kingdom, and Ireland. @param parse_shipment_request_body [ParseShipmentRequestBody] The only required field is &#x60;text&#x60;, which is the text to be parsed. You can optionally also provide a &#x60;shipment&#x60; containing any already-known values. For example, you probably already know the &#x60;ship_from&#x60; address, and you may also already know what carrier and service you want to use. @param [Hash] opts the optional parameters @return [ParseShipmentResponseBody]

# File lib/openapi_client/api/shipments_api.rb, line 587
def parse_shipment(parse_shipment_request_body, opts = {})
  data, _status_code, _headers = parse_shipment_with_http_info(parse_shipment_request_body, opts)
  data
end
parse_shipment_with_http_info(parse_shipment_request_body, opts = {}) click to toggle source

Parse shipping info The shipment-recognition API makes it easy for you to extract shipping data from unstructured text, including people&#39;s names, addresses, package weights and dimensions, insurance and delivery requirements, and more. Data often enters your system as unstructured text (for example: emails, SMS messages, support tickets, or other documents). ShipEngine&#39;s shipment-recognition API helps you extract meaningful, structured data from this unstructured text. The parsed shipment data is returned in the same structure that&#39;s used for other ShipEngine APIs, so you can easily use the parsed data to create a shipping label. &gt; Note: Shipment recognition is currently supported for the United States, Canada, Australia, New Zealand, the United Kingdom, and Ireland. @param parse_shipment_request_body [ParseShipmentRequestBody] The only required field is &#x60;text&#x60;, which is the text to be parsed. You can optionally also provide a &#x60;shipment&#x60; containing any already-known values. For example, you probably already know the &#x60;ship_from&#x60; address, and you may also already know what carrier and service you want to use. @param [Hash] opts the optional parameters @return [Array<(ParseShipmentResponseBody, Integer, Hash)>] ParseShipmentResponseBody data, response status code and response headers

# File lib/openapi_client/api/shipments_api.rb, line 597
def parse_shipment_with_http_info(parse_shipment_request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ShipmentsApi.parse_shipment ...'
  end
  # verify the required parameter 'parse_shipment_request_body' is set
  if @api_client.config.client_side_validation && parse_shipment_request_body.nil?
    fail ArgumentError, "Missing the required parameter 'parse_shipment_request_body' when calling ShipmentsApi.parse_shipment"
  end
  # resource path
  local_var_path = '/v1/shipments/recognize'

  # 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(parse_shipment_request_body) 

  # return_type
  return_type = opts[:return_type] || 'ParseShipmentResponseBody' 

  # 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: ShipmentsApi#parse_shipment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
tag_shipment(shipment_id, tag_name, opts = {}) click to toggle source

Add Tag to Shipment Add a tag to the shipment object @param shipment_id [String] Shipment ID @param tag_name [String] @param [Hash] opts the optional parameters @return [TagShipmentResponseBody]

# File lib/openapi_client/api/shipments_api.rb, line 652
def tag_shipment(shipment_id, tag_name, opts = {})
  data, _status_code, _headers = tag_shipment_with_http_info(shipment_id, tag_name, opts)
  data
end
tag_shipment_with_http_info(shipment_id, tag_name, opts = {}) click to toggle source

Add Tag to Shipment Add a tag to the shipment object @param shipment_id [String] Shipment ID @param tag_name [String] @param [Hash] opts the optional parameters @return [Array<(TagShipmentResponseBody, Integer, Hash)>] TagShipmentResponseBody data, response status code and response headers

# File lib/openapi_client/api/shipments_api.rb, line 663
def tag_shipment_with_http_info(shipment_id, tag_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ShipmentsApi.tag_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 ShipmentsApi.tag_shipment"
  end
  if @api_client.config.client_side_validation && shipment_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "shipment_id" when calling ShipmentsApi.tag_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 ShipmentsApi.tag_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 ShipmentsApi.tag_shipment, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'tag_name' is set
  if @api_client.config.client_side_validation && tag_name.nil?
    fail ArgumentError, "Missing the required parameter 'tag_name' when calling ShipmentsApi.tag_shipment"
  end
  if @api_client.config.client_side_validation && tag_name.to_s.length < 1
    fail ArgumentError, 'invalid value for "tag_name" when calling ShipmentsApi.tag_shipment, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/shipments/{shipment_id}/tags/{tag_name}'.sub('{' + 'shipment_id' + '}', CGI.escape(shipment_id.to_s)).sub('{' + 'tag_name' + '}', CGI.escape(tag_name.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] || 'TagShipmentResponseBody' 

  # 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: ShipmentsApi#tag_shipment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
untag_shipment(shipment_id, tag_name, opts = {}) click to toggle source

Remove Tag from Shipment Remove an existing tag from the Shipment object @param shipment_id [String] Shipment ID @param tag_name [String] @param [Hash] opts the optional parameters @return [String]

# File lib/openapi_client/api/shipments_api.rb, line 737
def untag_shipment(shipment_id, tag_name, opts = {})
  data, _status_code, _headers = untag_shipment_with_http_info(shipment_id, tag_name, opts)
  data
end
untag_shipment_with_http_info(shipment_id, tag_name, opts = {}) click to toggle source

Remove Tag from Shipment Remove an existing tag from the Shipment object @param shipment_id [String] Shipment ID @param tag_name [String] @param [Hash] opts the optional parameters @return [Array<(String, Integer, Hash)>] String data, response status code and response headers

# File lib/openapi_client/api/shipments_api.rb, line 748
def untag_shipment_with_http_info(shipment_id, tag_name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ShipmentsApi.untag_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 ShipmentsApi.untag_shipment"
  end
  if @api_client.config.client_side_validation && shipment_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "shipment_id" when calling ShipmentsApi.untag_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 ShipmentsApi.untag_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 ShipmentsApi.untag_shipment, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'tag_name' is set
  if @api_client.config.client_side_validation && tag_name.nil?
    fail ArgumentError, "Missing the required parameter 'tag_name' when calling ShipmentsApi.untag_shipment"
  end
  if @api_client.config.client_side_validation && tag_name.to_s.length < 1
    fail ArgumentError, 'invalid value for "tag_name" when calling ShipmentsApi.untag_shipment, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/shipments/{shipment_id}/tags/{tag_name}'.sub('{' + 'shipment_id' + '}', CGI.escape(shipment_id.to_s)).sub('{' + 'tag_name' + '}', CGI.escape(tag_name.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(['text/plain', 'application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'String' 

  # 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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ShipmentsApi#untag_shipment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_shipment(shipment_id, update_shipment_request_body, opts = {}) click to toggle source

Update Shipment By ID Update a shipment object based on its ID @param shipment_id [String] Shipment ID @param update_shipment_request_body [UpdateShipmentRequestBody] @param [Hash] opts the optional parameters @return [UpdateShipmentResponseBody]

# File lib/openapi_client/api/shipments_api.rb, line 822
def update_shipment(shipment_id, update_shipment_request_body, opts = {})
  data, _status_code, _headers = update_shipment_with_http_info(shipment_id, update_shipment_request_body, opts)
  data
end
update_shipment_with_http_info(shipment_id, update_shipment_request_body, opts = {}) click to toggle source

Update Shipment By ID Update a shipment object based on its ID @param shipment_id [String] Shipment ID @param update_shipment_request_body [UpdateShipmentRequestBody] @param [Hash] opts the optional parameters @return [Array<(UpdateShipmentResponseBody, Integer, Hash)>] UpdateShipmentResponseBody data, response status code and response headers

# File lib/openapi_client/api/shipments_api.rb, line 833
def update_shipment_with_http_info(shipment_id, update_shipment_request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ShipmentsApi.update_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 ShipmentsApi.update_shipment"
  end
  if @api_client.config.client_side_validation && shipment_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "shipment_id" when calling ShipmentsApi.update_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 ShipmentsApi.update_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 ShipmentsApi.update_shipment, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'update_shipment_request_body' is set
  if @api_client.config.client_side_validation && update_shipment_request_body.nil?
    fail ArgumentError, "Missing the required parameter 'update_shipment_request_body' when calling ShipmentsApi.update_shipment"
  end
  # resource path
  local_var_path = '/v1/shipments/{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(update_shipment_request_body) 

  # return_type
  return_type = opts[:return_type] || 'UpdateShipmentResponseBody' 

  # 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: ShipmentsApi#update_shipment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end