Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
[ANN] Shipping for Ruby
Lucas Carlson
4/27/2005 5:47:00 PM
Shipping is a module that connects APIs for various shippers like UPS
and FedEx. It is available as a ruby gem:
gem install shipping
or from rubyforge
http://rubyforge.org/project...
There is going to be some data that will persist for all shipments. For
example, you will not want to repeat the fedex account number every
time in your implementation code. To set default values, setup a file
called .shipping.yml in the home directory of the user who will be
using this library. An example file would be:
fedex_url: https://url/to/fedex/api
fedex_account: 1234556
fedex_meter: 387878
ups_account: 7B4F74E3075AEEFF
ups_user: username
ups_password: password
You can set as many default values as you would like in this file.
require 'shipping'
ups = Shipping::UPS.new :zip => 97202, :sender_zip => 10001,
:weight => 2
ups.price => 8.77
ups.valid_address? => false
ups.city = "Portland"
ups.valid_address? => true
Alternately, you can instantiate the base class and then see both UPS
and FedEx information.
ship = Shipping::Base.new :zip => 97202, :state => "OR",
:sender_zip => 10001, :weight => 2
ship.ups.price => 8.77
ship.fedex.price => 5.17
ship.city = "Portland"
ship.ups.valid_address? => true
I hope you enjoy this library,
-Lucas Carlson
http://tech...
3 Answers
Joe Van Dyk
4/27/2005 6:10:00 PM
0
On 4/27/05, Lucas Carlson <lucas@rufy.com> wrote:
> Shipping is a module that connects APIs for various shippers like UPS
> and FedEx. It is available as a ruby gem:
>
> gem install shipping
>
> or from rubyforge
>
>
http://rubyforge.org/project...
>
> There is going to be some data that will persist for all shipments. For
> example, you will not want to repeat the fedex account number every
> time in your implementation code. To set default values, setup a file
> called .shipping.yml in the home directory of the user who will be
> using this library. An example file would be:
>
> fedex_url: https://url/to/fedex/api
> fedex_account: 1234556
> fedex_meter: 387878
>
> ups_account: 7B4F74E3075AEEFF
> ups_user: username
> ups_password: password
>
> You can set as many default values as you would like in this file.
>
> require 'shipping'
>
> ups = Shipping::UPS.new :zip => 97202, :sender_zip => 10001,
> :weight => 2
> ups.price => 8.77
> ups.valid_address? => false
>
> ups.city = "Portland"
> ups.valid_address? => true
>
> Alternately, you can instantiate the base class and then see both UPS
> and FedEx information.
>
> ship = Shipping::Base.new :zip => 97202, :state => "OR",
> :sender_zip => 10001, :weight => 2
> ship.ups.price => 8.77
> ship.fedex.price => 5.17
>
> ship.city = "Portland"
> ship.ups.valid_address? => true
>
> I hope you enjoy this library,
>
> -Lucas Carlson
Great! Does this include tracking?
Lucas Carlson
4/27/2005 6:30:00 PM
0
It will soon. Feel free to chip in patches by working on the subversion
trunk:
http://rufy.com/svn/ship...
-Lucas Carlson
http://tech...
ES
4/27/2005 8:48:00 PM
0
Le 27/4/2005, "Lucas Carlson" <lucas@rufy.com> a écrit:
>It will soon. Feel free to chip in patches by working on the subversion
>trunk:
>
>
http://rufy.com/svn/ship...
I will note it here, just in case: I tentatively promised
to write the code for USPS shipping (and will try to do so
as soon as I get the appropriate permissions from them).
>-Lucas Carlson
E
--
template<typename duck>
void quack(duck& d) { d.quack(); }
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
[ANN] Shipping for Ruby
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password