simple_shipping

Ruby client for FedEx and UPS

https://github.com/joelparkerhenderson/simple_shipping

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.6%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Ruby client for FedEx and UPS

Basic Info
  • Host: GitHub
  • Owner: joelparkerhenderson
  • License: other
  • Language: Ruby
  • Default Branch: master
  • Homepage:
  • Size: 300 KB
Statistics
  • Stars: 1
  • Watchers: 2
  • Forks: 3
  • Open Issues: 0
  • Releases: 0
Created about 12 years ago · Last pushed 11 months ago
Metadata Files
Readme License Code of conduct Citation

README.markdown

Simple Shipping

Build Status

Provides a common simple API to build labels for the following shipping services:

Installation

Add to Gemfile:

gem 'simple_shipping'

Run bundle install.

Usage

```ruby

Build shipper

shipperaddress = SimpleShipping::Address.new( :countrycode => 'US', :statecode => 'TX', :city => 'Texas', :streetline => 'SN2000 Test Meter 8', :postalcode => '73301' ) shippercontact = SimpleShipping::Contact.new( :personname => 'Mister Someone', :phonenumber => '1234567890' ) shipper = SimpleShipping::Party.new( :address => shipperaddress, :contact => shippercontact )

Build recipient

recipientaddress = SimpleShipping::Address.new( :countrycode => 'US', :statecode => 'MN', :city => 'Minneapolis', :streetline => 'Nightmare Avenue 13', :postalcode => '55411' ) recipientcontact = SimpleShipping::Contact.new( :personname => "John Recipient Smith", :phonenumber => "1234567890" ) recipient = SimpleShipping::Party.new( :address => recipientaddress, :contact => recipientcontact, # optional, but required if party is payor :accountnumber => ACCOUNTNUMBER )

package = SimpleShipping::Package.new( :weight => 1, :length => 2, :height => 3, :dimensionunits => :in, # you can use :cm as well :weightunits => :lb, # you can use :kg as well :width => 4, :packaging_type => :your )

Create clients

fedex = SimpleShipping::Fedex::Client.new( :credentials => { :key => KEY, :password => PASSWORD, :accountnumber => ACCOUNTNUMBER, :meternumber => METERNUMBER }) ups = SimpleShipping::Ups::ShipClient.new( :credentials => { :username => USERNAME, :password => PASSWORD, :accesslicensenumber => ACCESSLICENSENUMBER } )

Do request

Default payor is :shipper

upsresp = ups.shipmentrequest(shipper, recipient, package) fedex_resp = fedex.request(shipper, recipient, package, :payor => :recipient) ```

Specific extra options

You can customize the request using specific options for the service by passing an options hash:

FedEx extra options

  • :dropoff_type (see SimpleShipping::Fedex::ShipmentBuilder::DROPOFF_TYPES for available values)
  • :service_type (see SimpleShipping::Fedex::ShipmentBuilder::SERVICE_TYPES for available values)

Example: ruby fedex_client.request(shipper, recipient, package, :dropoff_type => :drop_box)

UPS extra options

  • service_type (see SimpleShipping::Ups::ShipmentBuilder::SERVICE_TYPES for available values)

Example ruby ups_client.shipment_request(shipper, recipient, package, :service_type => :express)

Requirements

You must have ImageMagick installed to run the demos.

Linux

Gentoo

emerge -pv imagemagick emerge imagemagick

Ubuntu

sudo apt-get install imagemagick libmagic-dev libmagicwand-dev

OS X

Homebrew

brew install imagemagick

MacPorts

sudo port install imagemagick

Fink

fink install imagemagick

Developers information

SimpleShipping provides the following models which inherit SimpleShipping::Abstract::Model: * Shipment * Package * Party * Address * Contact

Every service adapter has its own builders which know how to represent every separated model to build SOAP request for a specific service. For example to represent Package model, the FedEx adapter has Fedex::PackageBuilder and the UPS adapter has Ups::PackageBuilder. All these model builders inherit SimpleShipping::Abstract::Builder.

Request builders are used to build whole request for the service. They inherit Abstract::RequestBuilder.

Client is a facade which provides a public API to the user. Every service has its own client but they all inherit Abstract::Client. All clients provide the same interface: * .new(credentials_hash) * #request(shipper, recipient, package, opts)

Demo rake tasks

You can test the library against real remote requests. For this you need to have a yaml file with your private credentials, for example credentials.yml wich looks this way:

```yaml fedex: key: "KEY" password: "SECRET" accountnumber: "ACCOUNT NUM" meternumber: "METER NUM"

ups: username: "USER" accountnumber: "ACCOUNT NUM" password: "SECRET" :accesslicense_number: "LICENSE NUM" ```

To run demo tasks: rake demo:fedex:shipment_request[credentials.yml] rake demo:ups:shipment_request[credentials.yml] rake demo:ups:void_request[credentials.yml]

UPS certification

To run UPS certification:

./script/ups_certification.rb ./credentials.yml

Where credentials.yml is file with format described above.

TODO

  • Validation for country codes and states?
  • Refactor
  • Ability to get more information from response object than just a label(tracking number, etc)

Contributing to simple_shipping

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright (c) 2011 TMX Credit. Author Potapov Sergey. See LICENSE.txt for further details.

Owner

  • Name: Joel Parker Henderson
  • Login: joelparkerhenderson
  • Kind: user
  • Location: California

Software developer. Technology consultant. Creator of GitAlias.com, NumCommand.com, SixArm.com, and many open source projects.

Citation (CITATION.cff)

cff-version: 1.2.0
title: 
message: >-
  If you use this work and you want to cite it,
  then you can use the metadata from this file.
type: software
authors:
  - given-names: Joel Parker
    family-names: Henderson
    email: joel@joelparkerhenderson.com
    affiliation: joelparkerhenderson.com
    orcid: 'https://orcid.org/0009-0000-4681-282X'
identifiers:
  - type: url
    value: 'https://github.com/joelparkerhenderson/simple_shipping/'
    description: 
repository-code: 'https://github.com/joelparkerhenderson/simple_shipping/'
abstract: >-
  
license: See license file

GitHub Events

Total
  • Push event: 1
Last Year
  • Push event: 1

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

Gemfile rubygems
  • bundler >= 0 development
  • equivalent-xml >= 0 development
  • erubis >= 0 development
  • forgery >= 0 development
  • jeweler >= 0 development
  • json_pure >= 0 development
  • metric_fu >= 0 development
  • rmagick >= 0 development
  • rspec ~> 2.14.0 development
  • simplecov >= 0 development
  • simplecov-rcov-text >= 0 development
  • timecop >= 0 development
  • webmock >= 0 development
  • yard >= 0 development
  • activemodel ~> 3.1
  • activesupport ~> 3.1
  • savon ~> 2.2.0
Gemfile.lock rubygems
  • activemodel 3.2.16
  • activesupport 3.2.16
  • addressable 2.3.5
  • akami 1.2.0
  • arrayfields 4.9.0
  • awesome_print 1.2.0
  • builder 3.0.4
  • cane 2.6.1
  • chronic 0.10.2
  • churn 0.0.35
  • code_analyzer 0.4.4
  • code_metrics 0.1.3
  • coderay 1.1.0
  • colored 1.2
  • crack 0.4.1
  • descendants_tracker 0.0.3
  • diff-lcs 1.2.5
  • docile 1.1.2
  • equivalent-xml 0.4.0
  • erubis 2.7.0
  • faraday 0.8.9
  • fattr 2.2.1
  • flay 2.4.0
  • flog 4.2.0
  • forgery 0.5.0
  • git 1.2.6
  • github_api 0.11.1
  • gyoku 1.0.0
  • hashie 2.0.5
  • highline 1.6.20
  • hirb 0.7.1
  • httpauth 0.2.0
  • httpi 2.0.2
  • i18n 0.6.9
  • jeweler 2.0.0
  • json 1.8.1
  • json_pure 1.8.1
  • jwt 0.1.8
  • main 5.2.0
  • map 6.5.1
  • metric_fu 4.7.1
  • metric_fu-Saikuro 1.1.1.0
  • mime-types 2.0
  • mini_portile 0.5.2
  • multi_json 1.8.3
  • multi_xml 0.5.5
  • multipart-post 1.2.0
  • nokogiri 1.6.1
  • nori 2.1.0
  • oauth2 0.9.2
  • parallel 0.9.1
  • rack 1.5.2
  • rails_best_practices 1.14.4
  • rake 10.1.1
  • rdoc 4.1.1
  • redcard 1.1.0
  • reek 1.3.6
  • require_all 1.3.2
  • rest-client 1.6.7
  • rmagick 2.13.2
  • roodi 3.3.1
  • rspec 2.14.1
  • rspec-core 2.14.7
  • rspec-expectations 2.14.4
  • rspec-mocks 2.14.4
  • ruby-progressbar 1.4.0
  • ruby2ruby 2.0.7
  • ruby_parser 3.2.2
  • safe_yaml 0.9.7
  • savon 2.2.0
  • sexp_processor 4.4.1
  • simplecov 0.8.2
  • simplecov-html 0.8.0
  • simplecov-rcov-text 0.0.2
  • timecop 0.7.1
  • wasabi 3.1.0
  • webmock 1.16.1
  • yard 0.8.7.3
simple_shipping.gemspec rubygems
  • bundler >= 0 development
  • forgery >= 0 development
  • jeweler >= 0 development
  • json_pure >= 0 development
  • metric_fu >= 0 development
  • rmagick >= 0 development
  • rspec ~> 2.14.0 development
  • yard >= 0 development
  • activemodel ~> 3.1
  • activesupport ~> 3.1
  • bundler >= 0
  • forgery >= 0
  • jeweler >= 0
  • json_pure >= 0
  • metric_fu >= 0
  • rmagick >= 0
  • rspec ~> 2.14.0
  • savon ~> 2.2.0
  • yard >= 0