ClickAndSend
Ruby adapter for Australia Post's ClickAndSend API.
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.account_number = '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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request