ClickAndSend

Ruby adapter for Australia Post's ClickAndSend API.

Build Status

Installation

Add this line to your application's Gemfile:

gem 'click_and_send'

And then execute:

$ bundle

Or install it yourself as:

$ gem install click_and_send

Usage

Configure like this:

ClickAndSend.configure do |c|
  c. = '1234567'
  c.api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
  c.user_name = 'acme'
  c.wsdl = 'https://auspost-staging.oss.neopost-id.com/modules/oss/api/ship/wsdl?sz_Client=AustraliaPost'
end

Note that the WSDL URL above is for ClickAndSend's staging environment.

You should only need to call methods on the ClickAndSend class. Refer to ClickAndSend docs and acceptance tests for usage examples.

Optionally configure a logger. It defaults to a standard Logger instance writing to log/click_and_send.log or Rails.logger when applicable.

# Set logfile
ClickAndSend.configure do |c|
  c.logfile = 'path/to/my/logfile'
end

# Custom logger
ClickAndSend.configure do |c|
  c.logger = MyApp.logger
end

Gotchas

Order is important for ClickAndSend API data structures. Therefore, under ruby 1.8, use ActiveSupport::OrderedHash instead of a regular hash.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request