-
Notifications
You must be signed in to change notification settings - Fork 4
A simple Ruby interface to the UPS Time in Transit API
License
joestelmach/ups_time_in_transit
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
ups_time_in_transit is an easy to use interface to the UPS Time in Transit API. == installation == gem install ups_time_in_transit == usage == # define your access options. These are options that won't change # between requests. Take care to specify the proper UPS url: # 'https://wwwcie.ups.com/ups.app/xml/TimeInTransit' for testing and # development, and 'https://onlinetools.ups.com/ups.app/xml/TimeInTransit' # for production. access_options = { :url => 'https://wwwcie.ups.com/ups.app/xml/TimeInTransit', :access_license_number => 'foo', :user_id => 'bar', :password => 'baz', :order_cutoff_time => 17 , :sender_city => 'Hoboken', :sender_state => 'NJ', :sender_country_code => 'US', :sender_zip => '07030'} # It's best to store these these options in a yaml file and load them # into a map when you need them: yaml = YAML.load_file("#{RAILS_ROOT}/config/ups_time_in_transit.yml") access_options = yaml[RAILS_ENV].inject({}){|h,(k, v)| h[k.to_sym] = v; h} # create an api instance with your access options time_in_transit_api = UPS::TimeInTransit.new(access_options) # for each request, generate a map of request options describing # the shipment and where it's going request_options = { :total_packages => 1, :unit_of_measurement => 'LBS', :weight => 10, :city => 'Newark', :state => 'DE', :zip => '19711', :country_code => 'US'} # request the map of delivery types (overnight, ground, etc.) to the expected # delivery date for that type. Be sure to rescue any errors. begin delivery_dates = time_in_transit_api.request(request_options) rescue => error puts error.inspect end == changelog == v.0.1.1 some erroneous documentation v.0.1.0 initial release
About
A simple Ruby interface to the UPS Time in Transit API
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published