openapi_client

OpenapiClient - 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.0
  • 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 openapi_client.gemspec

Then either install the gem locally:

gem install ./openapi_client-1.0.0.gem

(for development, run gem install --dev ./openapi_client-1.0.0.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 'openapi_client', '~> 1.0.0'

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 'openapi_client', :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 'openapi_client'

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