Git Product home page Git Product logo

brownie's Introduction

brownie

Brownie helps you create shipments via UPS.com's developer api. This gem is a work in progress. You can create shipments, and labels.

Future releasess will have address valdation, and tracking

Install

gem 'brownie', '~> 0.2.1'

Usage

b = Brownie::Shipment.new
b.account_number = "YOUR UPS ACCOUNT NUMBER"
b.credentials.license_number = "YOUR UPS DEVELOPER API LICENCE NUMBER"
b.credentials.user_id = "YOUR UPS LOGIN"
b.credentials.password = "YOU UPS PASSWORD"

b.shipper.account_number = b.account_number
b.shipper.name = "Sample Company Name"
b.shipper.phone_number = "555-666-7777"
b.shipper.tax_identification_number = "1234567890"
b.shipper.address_line1 = "123 Test Street"
b.shipper.city = "Test Town"
b.shipper.state_province_code = "NY"
b.shipper.postal_code = "10021"
b.shipper.country_code = "US"

b.ship_to.company_name = "SHIP TO COMPANY/NAME"
b.ship_to.attention_name = "SHIP TO NAME"
b.ship_to.phone_number = "5556667777"
b.ship_to.address_line1 = "555 Test Rd"
b.ship_to.city = "Test City"
b.ship_to.state_province_code = "CA"
b.ship_to.postal_code = "90212"
b.ship_to.country_code = "US"

b.ship_from.company_name = "Sample Company Name"
b.ship_from.attention_name = "Sample NAme"
b.ship_from.phone_number = "5556667777"
b.ship_from.address_line1 = "123 Test Street"
b.ship_from.state_province_code = "NY"
b.ship_from.city = "Test Town"
b.ship_from.postal_code = "07738"
b.ship_from.country_code = "US"

b.service_code = Brownie::ServiceCodes::GROUND
b.package.package_type = Brownie::Package::CUSTOMER_SUPPLIED_PACKAGE
b.package.declared_value = 100
b.package.unit_of_measurement = Brownie::Dimensions::INCHES
b.package.length = 6
b.package.width = 6
b.package.height = 4

# Confirm and Validate Shipment
if b.confirm
   puts b.tracking_number
else 
   puts b.errors
end


# Accept and Download Label
b.label(b.shipment_digest,"/path/to/save/label.gif")

TODO

  • Add addresss validation
  • Add more local validations and error checking

Contributing to brownie

  • 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) 2014 Michael Jaffe. See LICENSE.txt for further details.

brownie's People

Contributors

mikejaffe avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.