class ShipEngine::WarehousesApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

create_warehouse(create_warehouse_request_body, opts = {}) click to toggle source

Create Warehouse Create a warehouse location that you can use to create shipping items by simply passing in the generated warehouse id. If the return address is not supplied in the request body then it is assumed that the origin address is the return address as well @param create_warehouse_request_body [CreateWarehouseRequestBody] @param [Hash] opts the optional parameters @return [CreateWarehouseResponseBody]

# File lib/ship_engine/api/warehouses_api.rb, line 27
def create_warehouse(create_warehouse_request_body, opts = {})
  data, _status_code, _headers = create_warehouse_with_http_info(create_warehouse_request_body, opts)
  data
end
create_warehouse_with_http_info(create_warehouse_request_body, opts = {}) click to toggle source

Create Warehouse Create a warehouse location that you can use to create shipping items by simply passing in the generated warehouse id. If the return address is not supplied in the request body then it is assumed that the origin address is the return address as well @param create_warehouse_request_body [CreateWarehouseRequestBody] @param [Hash] opts the optional parameters @return [Array<(CreateWarehouseResponseBody, Integer, Hash)>] CreateWarehouseResponseBody data, response status code and response headers

# File lib/ship_engine/api/warehouses_api.rb, line 37
def create_warehouse_with_http_info(create_warehouse_request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WarehousesApi.create_warehouse ...'
  end
  # verify the required parameter 'create_warehouse_request_body' is set
  if @api_client.config.client_side_validation && create_warehouse_request_body.nil?
    fail ArgumentError, "Missing the required parameter 'create_warehouse_request_body' when calling WarehousesApi.create_warehouse"
  end
  # resource path
  local_var_path = '/v1/warehouses'

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

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

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

Delete Warehouse By ID Delete a warehouse by ID @param warehouse_id [String] Warehouse ID @param [Hash] opts the optional parameters @return [String]

# File lib/ship_engine/api/warehouses_api.rb, line 91
def delete_warehouse(warehouse_id, opts = {})
  data, _status_code, _headers = delete_warehouse_with_http_info(warehouse_id, opts)
  data
end
delete_warehouse_with_http_info(warehouse_id, opts = {}) click to toggle source

Delete Warehouse By ID Delete a warehouse by ID @param warehouse_id [String] Warehouse ID @param [Hash] opts the optional parameters @return [Array<(String, Integer, Hash)>] String data, response status code and response headers

# File lib/ship_engine/api/warehouses_api.rb, line 101
def delete_warehouse_with_http_info(warehouse_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WarehousesApi.delete_warehouse ...'
  end
  # verify the required parameter 'warehouse_id' is set
  if @api_client.config.client_side_validation && warehouse_id.nil?
    fail ArgumentError, "Missing the required parameter 'warehouse_id' when calling WarehousesApi.delete_warehouse"
  end
  if @api_client.config.client_side_validation && warehouse_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "warehouse_id" when calling WarehousesApi.delete_warehouse, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && warehouse_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "warehouse_id" when calling WarehousesApi.delete_warehouse, 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 && warehouse_id !~ pattern
    fail ArgumentError, "invalid value for 'warehouse_id' when calling WarehousesApi.delete_warehouse, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/warehouses/{warehouse_id}'.sub('{' + 'warehouse_id' + '}', CGI.escape(warehouse_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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WarehousesApi#delete_warehouse\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_warehouse_by_id(warehouse_id, opts = {}) click to toggle source

Get Warehouse By Id Retrieve warehouse data based on the warehouse ID @param warehouse_id [String] Warehouse ID @param [Hash] opts the optional parameters @return [GetWarehouseByIdResponseBody]

# File lib/ship_engine/api/warehouses_api.rb, line 166
def get_warehouse_by_id(warehouse_id, opts = {})
  data, _status_code, _headers = get_warehouse_by_id_with_http_info(warehouse_id, opts)
  data
end
get_warehouse_by_id_with_http_info(warehouse_id, opts = {}) click to toggle source

Get Warehouse By Id Retrieve warehouse data based on the warehouse ID @param warehouse_id [String] Warehouse ID @param [Hash] opts the optional parameters @return [Array<(GetWarehouseByIdResponseBody, Integer, Hash)>] GetWarehouseByIdResponseBody data, response status code and response headers

# File lib/ship_engine/api/warehouses_api.rb, line 176
def get_warehouse_by_id_with_http_info(warehouse_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WarehousesApi.get_warehouse_by_id ...'
  end
  # verify the required parameter 'warehouse_id' is set
  if @api_client.config.client_side_validation && warehouse_id.nil?
    fail ArgumentError, "Missing the required parameter 'warehouse_id' when calling WarehousesApi.get_warehouse_by_id"
  end
  if @api_client.config.client_side_validation && warehouse_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "warehouse_id" when calling WarehousesApi.get_warehouse_by_id, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && warehouse_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "warehouse_id" when calling WarehousesApi.get_warehouse_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 && warehouse_id !~ pattern
    fail ArgumentError, "invalid value for 'warehouse_id' when calling WarehousesApi.get_warehouse_by_id, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/warehouses/{warehouse_id}'.sub('{' + 'warehouse_id' + '}', CGI.escape(warehouse_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] || 'GetWarehouseByIdResponseBody' 

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

List Warehouses Retrieve a list of warehouses associated with this account. @param [Hash] opts the optional parameters @return [ListWarehousesResponseBody]

# File lib/ship_engine/api/warehouses_api.rb, line 240
def list_warehouses(opts = {})
  data, _status_code, _headers = list_warehouses_with_http_info(opts)
  data
end
list_warehouses_with_http_info(opts = {}) click to toggle source

List Warehouses Retrieve a list of warehouses associated with this account. @param [Hash] opts the optional parameters @return [Array<(ListWarehousesResponseBody, Integer, Hash)>] ListWarehousesResponseBody data, response status code and response headers

# File lib/ship_engine/api/warehouses_api.rb, line 249
def list_warehouses_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WarehousesApi.list_warehouses ...'
  end
  # resource path
  local_var_path = '/v1/warehouses'

  # 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] || 'ListWarehousesResponseBody' 

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

Update WareHouse By Id Update Warehouse object information @param update_warehouse_request_body [UpdateWarehouseRequestBody] @param warehouse_id [String] Warehouse ID @param [Hash] opts the optional parameters @return [String]

# File lib/ship_engine/api/warehouses_api.rb, line 298
def update_warehouse(update_warehouse_request_body, warehouse_id, opts = {})
  data, _status_code, _headers = update_warehouse_with_http_info(update_warehouse_request_body, warehouse_id, opts)
  data
end
update_warehouse_with_http_info(update_warehouse_request_body, warehouse_id, opts = {}) click to toggle source

Update WareHouse By Id Update Warehouse object information @param update_warehouse_request_body [UpdateWarehouseRequestBody] @param warehouse_id [String] Warehouse ID @param [Hash] opts the optional parameters @return [Array<(String, Integer, Hash)>] String data, response status code and response headers

# File lib/ship_engine/api/warehouses_api.rb, line 309
def update_warehouse_with_http_info(update_warehouse_request_body, warehouse_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WarehousesApi.update_warehouse ...'
  end
  # verify the required parameter 'update_warehouse_request_body' is set
  if @api_client.config.client_side_validation && update_warehouse_request_body.nil?
    fail ArgumentError, "Missing the required parameter 'update_warehouse_request_body' when calling WarehousesApi.update_warehouse"
  end
  # verify the required parameter 'warehouse_id' is set
  if @api_client.config.client_side_validation && warehouse_id.nil?
    fail ArgumentError, "Missing the required parameter 'warehouse_id' when calling WarehousesApi.update_warehouse"
  end
  if @api_client.config.client_side_validation && warehouse_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "warehouse_id" when calling WarehousesApi.update_warehouse, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && warehouse_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "warehouse_id" when calling WarehousesApi.update_warehouse, 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 && warehouse_id !~ pattern
    fail ArgumentError, "invalid value for 'warehouse_id' when calling WarehousesApi.update_warehouse, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/warehouses/{warehouse_id}'.sub('{' + 'warehouse_id' + '}', CGI.escape(warehouse_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'])
  # 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_warehouse_request_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: WarehousesApi#update_warehouse\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end