Skip to content

Latest commit

 

History

History
148 lines (108 loc) · 6.65 KB

README.md

File metadata and controls

148 lines (108 loc) · 6.65 KB

click_and_drop

ClickAndDrop - the Ruby gem for the ChannelShipper & Royal Mail Public API

Import your orders, retrieve your orders and generate labels.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen

Installation

Build a gem

To build the Ruby code into a gem:

gem build click_and_drop.gemspec

Then either install the gem locally:

gem install ./click_and_drop-1.0.0.gem

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

# Setup authorization
ClickAndDrop.configure do |config|
  # Configure API key authorization: Bearer
  config.api_key['Bearer'] = '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['Bearer'] = 'Bearer'
end

api_instance = ClickAndDrop::LabelsApi.new
order_identifiers = 'order_identifiers_example' # String | One or several Order Identifiers or Order References separated by semicolon. Order Identifiers are integer numbers. Order References are strings - each must be percent-encoded and surrounded by double quotation marks.
document_type = 'postageLabel' # String | Document generation mode. When documentType is set to \"postageLabel\" the additional parameters below must be used. These additional parameters will be ignored when documentType is not set to \"postageLabel\"
opts = {
  include_returns_label: true, # Boolean | Include returns label. Required when documentType is set to 'postageLabel'
  include_cn: true # Boolean | Include CN22/CN23 with label. Optional parameter. If this parameter is used the setting will override the default account behaviour specified in the \"Label format\" setting \"Generate customs declarations with orders\"
}

begin
  #Return a single PDF file with generated label and/or associated document(s)
  result = api_instance.get_orders_label_async(order_identifiers, document_type, opts)
  p result
rescue ClickAndDrop::ApiError => e
  puts "Exception when calling LabelsApi->get_orders_label_async: #{e}"
end

Documentation for API Endpoints

All URIs are relative to /api/v1

Class Method HTTP request Description
ClickAndDrop::LabelsApi get_orders_label_async GET /orders/{orderIdentifiers}/label Return a single PDF file with generated label and/or associated document(s)
ClickAndDrop::OrdersApi create_orders_async POST /orders Create orders
ClickAndDrop::OrdersApi delete_orders_async DELETE /orders/{orderIdentifiers} Delete orders
ClickAndDrop::OrdersApi get_orders_async GET /orders/{orderIdentifiers} Retrieve orders
ClickAndDrop::OrdersApi get_orders_with_details_async GET /orders/{orderIdentifiers}/full Retrieve orders details
ClickAndDrop::OrdersApi update_orders_status_async PUT /orders/status Set order status
ClickAndDrop::VersionApi get_version_async GET /version Get API version details.

Documentation for Models

Documentation for Authorization

Bearer

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header