Skip to content

Gem for accessing the Endicia Label Server XML API from Ruby

License

Notifications You must be signed in to change notification settings

veeqo/endicia_label_server-ruby

 
 

Repository files navigation

Gem Version

Endicia Label Server

Endicia Label Server Gem for accessing the Endicia Label Server API from Ruby. Using the gem you can:

  • Return quotes from the Endicia Label Server API
  • Book shipments
  • Return labels and tracking numbers for a shipment

This gem is currently used in production at Veeqo

Installation

$ gem install endicia_label_server-ruby

...or add it to your project's Gemfile.

Documentation

Yard documentation can be found at RubyDoc.

Sample Usage

Return rates

# For testing on the command line
$ rake console
require 'endicia_label_server'
server = EndiciaLabelServer::Connection.new(test_mode: true)
response = server.rate do |rate_builder|
  rate_builder.add :certified_intermediary, {
    account_id: ENV['ENDICIA_ACCOUNT_ID'],
    pass_phrase: ENV['ENDICIA_PASS_PHRASE'] # or token: ENV['ENDICIA_TOKEN']
  }
  rate_builder.add :requester_id, ENV['ENDICIA_REQUESTER_ID']
  rate_builder.add :mail_class, EndiciaLabelServer::SERVICES.keys.first
  rate_builder.add :mailpiece_dimensions, {
    length: '10',
    width: '10',
    height: '10'
  }
  rate_builder.add :weight_oz, "2"
  rate_builder.add :from_postal_code, '90210'
  rate_builder.add :to_postal_code, '02215'
  rate_builder.add :to_country_code, 'US'
end
# Then use...
response.success?

Running the tests

After installing dependencies with bundle install, you can run the unit tests using rspec.

About

Gem for accessing the Endicia Label Server XML API from Ruby

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%