ship_engine

ShipEngine - the Ruby gem for the ShipEngine API

ShipEngine's easy-to-use REST API lets you manage all of your shipping needs without worrying about the complexities of different carrier APIs and protocols. We handle all the heavy lifting so you can focus on providing a first-class shipping experience for your customers at the best possible prices.

Each of ShipEngine's features can be used by itself or in conjunction with each other to build powerful shipping functionality into your application or service.

Getting Started

If you're new to REST APIs then be sure to read our introduction to REST to understand the basics. Learn how to authenticate yourself to ShipEngine, and then use our sandbox environment to kick the tires and get familiar with our API. If you run into any problems, then be sure to check the error handling guide for tips.

Here are some step-by-step tutorials to get you started:

Shipping Labels for Every Major Carrier

ShipEngine makes it easy to create shipping labels for any carrier and download them in a variety of file formats. You can even customize labels with your own messages and images.

Real-Time Package Tracking

With ShipEngine you can get the current status of a package or subscribe to real-time tracking updates via webhooks. You can also create custimized tracking pages with your own branding so your customers will always know where their package is.

Compare Shipping Costs Across Carriers

Make sure you ship as cost-effectively as possible by comparing rates across carriers using the ShipEngine Rates API. Or if you don't know the full shipment details yet, then you can get rate estimates with limited address info.

Worldwide Address Validation

ShipEngine supports address validation for virtually every country on Earth, including the United States, Canada, Great Britain, Australia, Germany, France, Norway, Spain, Sweden, Israel, Italy, and over 160 others.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.1.202006302006
  • Package version: 1.0.3
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit https://www.shipengine.com/contact/

Installation

Build a gem

To build the Ruby code into a gem:

gem build ship_engine.gemspec

Then either install the gem locally:

gem install ./ship_engine-1.0.3.gem

(for development, run gem install --dev ./ship_engine-1.0.3.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'ship_engine', '~> 1.0.3'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'ship_engine', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'ship_engine'

# Setup authorization
ShipEngine.configure do |config|
  # Configure API key authorization: api_key
  config.api_key['API-Key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['API-Key'] = 'Bearer'
end

api_instance = ShipEngine::AddressesApi.new
parse_address_request_body = {"text":"Margie McMiller at 3800 North Lamar suite 200 in austin, tx.  The zip code there is 78652."} # ParseAddressRequestBody | The only required field is `text`, which is the text to be parsed. You can optionally also provide an `address` containing already-known values. For example, you may already know the recipient's name, city, and country, and only want to parse the street address into separate lines. 

begin
  #Parse an address
  result = api_instance.parse_address(parse_address_request_body)
  p result
rescue ShipEngine::ApiError => e
  puts "Exception when calling AddressesApi->parse_address: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://api.shipengine.com

Class Method HTTP request Description
ShipEngine::AddressesApi parse_address PUT /v1/addresses/recognize Parse an address
ShipEngine::AddressesApi validate_address POST /v1/addresses/validate Validate An Address
ShipEngine::BatchesApi add_to_batch POST /v1/batches/batch_id/add Add to a Batch
ShipEngine::BatchesApi create_batch POST /v1/batches Create A Batch
ShipEngine::BatchesApi delete_batch DELETE /v1/batches/batch_id Delete Batch By Id
ShipEngine::BatchesApi get_batch_by_external_id GET /v1/batches/external_batch_id/external_batch_id Get Batch By External ID
ShipEngine::BatchesApi get_batch_by_id GET /v1/batches/batch_id Get Batch By ID
ShipEngine::BatchesApi list_batch_errors GET /v1/batches/batch_id/errors Get Batch Errors
ShipEngine::BatchesApi list_batches GET /v1/batches List Batches
ShipEngine::BatchesApi process_batch POST /v1/batches/batch_id/process/labels Process Batch ID Labels
ShipEngine::BatchesApi remove_from_batch POST /v1/batches/batch_id/remove Remove From Batch
ShipEngine::BatchesApi update_batch PUT /v1/batches/batch_id Update Batch By Id
ShipEngine::CarrierAccountsApi connect_carrier POST /v1/connections/carriers/carrier_name Connect a carrier account
ShipEngine::CarrierAccountsApi disconnect_carrier DELETE /v1/connections/carriers/carrier_name/carrier_id Disconnect a carrier
ShipEngine::CarrierAccountsApi get_carrier_settings GET /v1/connections/carriers/carrier_name/carrier_id/settings Get carrier settings
ShipEngine::CarrierAccountsApi update_carrier_settings PUT /v1/connections/carriers/carrier_name/carrier_id/settings Update carrier settings
ShipEngine::CarriersApi add_funds_to_carrier PUT /v1/carriers/carrier_id/add_funds Add Funds To Carrier
ShipEngine::CarriersApi get_carrier_by_id GET /v1/carriers/carrier_id Get Carrier By ID
ShipEngine::CarriersApi get_carrier_options GET /v1/carriers/carrier_id/options Get Carrier Options
ShipEngine::CarriersApi list_carrier_package_types GET /v1/carriers/carrier_id/packages List Carrier Package Types
ShipEngine::CarriersApi list_carrier_services GET /v1/carriers/carrier_id/services List Carrier Services
ShipEngine::CarriersApi list_carriers GET /v1/carriers List Carriers
ShipEngine::DownloadsApi download_file GET /v1/downloads/dir/subdir/filename Download File
ShipEngine::InsuranceApi add_funds_to_insurance PATCH /v1/insurance/shipsurance/add_funds Add Funds To Insurance
ShipEngine::InsuranceApi connect_insurer POST /v1/connections/insurance/shipsurance Connect a Shipsurance Account
ShipEngine::InsuranceApi disconnect_insurer DELETE /v1/connections/insurance/shipsurance Disconnect a Shipsurance Account
ShipEngine::InsuranceApi get_insurance_balance GET /v1/insurance/shipsurance/balance Get Insurance Funds Balance
ShipEngine::LabelsApi create_label POST /v1/labels Purchase Label
ShipEngine::LabelsApi create_label_from_rate POST /v1/labels/rates/rate_id Purchase Label with Rate ID
ShipEngine::LabelsApi create_label_from_shipment POST /v1/labels/shipment/shipment_id Purchase Label with Shipment ID
ShipEngine::LabelsApi create_return_label POST /v1/labels/label_id/return Create a return label
ShipEngine::LabelsApi get_label_by_external_shipment_id GET /v1/labels/external_shipment_id/external_shipment_id Get Label By External Shipment ID
ShipEngine::LabelsApi get_label_by_id GET /v1/labels/label_id Get Label By ID
ShipEngine::LabelsApi get_tracking_log_from_label GET /v1/labels/label_id/track Get Label Tracking Information
ShipEngine::LabelsApi list_labels GET /v1/labels List labels
ShipEngine::LabelsApi void_label PUT /v1/labels/label_id/void Void a Label By ID
ShipEngine::ManifestsApi create_manifest POST /v1/manifests Create Manifest
ShipEngine::ManifestsApi get_manifest_by_id GET /v1/manifests/manifest_id Get Manifest By Id
ShipEngine::ManifestsApi list_manifests GET /v1/manifests List Manifests
ShipEngine::PackageTypesApi create_package_type POST /v1/packages Create Custom Package Type
ShipEngine::PackageTypesApi delete_package_type DELETE /v1/packages/package_id Delete A Custom Package By ID
ShipEngine::PackageTypesApi get_package_type_by_id GET /v1/packages/package_id Get Custom Package Type By ID
ShipEngine::PackageTypesApi list_package_types GET /v1/packages List Custom Package Types
ShipEngine::PackageTypesApi update_package_type PUT /v1/packages/package_id Update Custom Package Type By ID
ShipEngine::RatesApi calculate_rates POST /v1/rates Get Shipping Rates
ShipEngine::RatesApi compare_bulk_rates POST /v1/rates/bulk Get Bulk Rates
ShipEngine::RatesApi estimate_rates POST /v1/rates/estimate Estimate Rates
ShipEngine::RatesApi get_rate_by_id GET /v1/rates/rate_id Get Rate By ID
ShipEngine::ShipmentsApi cancel_shipments PUT /v1/shipments/shipment_id/cancel Cancel a Shipment
ShipEngine::ShipmentsApi create_shipments POST /v1/shipments Create Shipments
ShipEngine::ShipmentsApi get_shipment_by_external_id GET /v1/shipments/external_shipment_id/external_shipment_id Get Shipment By External ID
ShipEngine::ShipmentsApi get_shipment_by_id GET /v1/shipments/shipment_id Get Shipment By ID
ShipEngine::ShipmentsApi list_shipment_errors GET /v1/shipments/shipment_id/errors Get Shipment Errors
ShipEngine::ShipmentsApi list_shipment_rates GET /v1/shipments/shipment_id/rates Get Shipment Rates
ShipEngine::ShipmentsApi list_shipments GET /v1/shipments List Shipments
ShipEngine::ShipmentsApi parse_shipment PUT /v1/shipments/recognize Parse shipping info
ShipEngine::ShipmentsApi tag_shipment POST /v1/shipments/shipment_id/tags/tag_name Add Tag to Shipment
ShipEngine::ShipmentsApi untag_shipment DELETE /v1/shipments/shipment_id/tags/tag_name Remove Tag from Shipment
ShipEngine::ShipmentsApi update_shipment PUT /v1/shipments/shipment_id Update Shipment By ID
ShipEngine::TagsApi create_tag POST /v1/tags/tag_name Create a New Tag
ShipEngine::TagsApi delete_tag DELETE /v1/tags/tag_name Delete Tag
ShipEngine::TagsApi list_tags GET /v1/tags Get Tags
ShipEngine::TagsApi rename_tag PUT /v1/tags/tag_name/new_tag_name Update Tag Name
ShipEngine::TrackingApi get_tracking_log GET /v1/tracking Get Tracking Information
ShipEngine::TrackingApi start_tracking POST /v1/tracking/start Start Tracking a Package
ShipEngine::TrackingApi stop_tracking POST /v1/tracking/stop Stop Tracking a Package
ShipEngine::WarehousesApi create_warehouse POST /v1/warehouses Create Warehouse
ShipEngine::WarehousesApi delete_warehouse DELETE /v1/warehouses/warehouse_id Delete Warehouse By ID
ShipEngine::WarehousesApi get_warehouse_by_id GET /v1/warehouses/warehouse_id Get Warehouse By Id
ShipEngine::WarehousesApi list_warehouses GET /v1/warehouses List Warehouses
ShipEngine::WarehousesApi update_warehouse PUT /v1/warehouses/warehouse_id Update WareHouse By Id
ShipEngine::WebhooksApi create_webhook POST /v1/environment/webhooks Create a Webhook
ShipEngine::WebhooksApi delete_webhook DELETE /v1/environment/webhooks/webhook_id Delete Webhook By ID
ShipEngine::WebhooksApi get_webhook_by_id GET /v1/environment/webhooks/webhook_id Get Webhook By ID
ShipEngine::WebhooksApi list_webhooks GET /v1/environment/webhooks List Webhooks
ShipEngine::WebhooksApi update_webhook PUT /v1/environment/webhooks/webhook_id Update a Webhook

Documentation for Models

Documentation for Authorization

api_key

  • Type: API key
  • API key parameter name: API-Key
  • Location: HTTP header