A simple wrapper around the Trazzler API (api.trazzler.com/).
Install the gem.
Standard gem install:
gem install trazzler-api
After installing the gem you would need to require it.
require 'trazzler-api'
In a Rails 2.x project you can add this to your environment.rb:
config.gem 'trazzler-api'
followed by:
rake gems:install
In Rails 3.x add this to your Gemfile:
gem 'trazzler-api'
followed by:
bundle install
Fetch trips sorted by their creation date (most recent first).
trazzler = TrazzlerApi::Trazzler.new trip_list = trazzler.trips trip_list.page trip_list.trips[0].title trip_list = trazzler.trips(:details => false, :page => 3)
This method supports all of the trips parameters supported by the Trazzler API. Simply pass the parameters into the method as a hash as shown above. Check out the documentation here: api.trazzler.com/about/api-docs#trips
Fetch trips sorted by distance from the specified location:
trazzler = TrazzlerApi::Trazzler.new trip_list = trazzler.trips_by_location(:location => '39.85,-86.03') trip_list.page trip_list.trips[0].title trip_list = trazzler.trips_by_location(:location => '39.85,-86.03', :details => false, :page => 3)
This method supports all of the trips_by_location parameters supported by the Trazzler API. Simply pass the parameters into the method as a hash as shown above. Check out the documentation here: api.trazzler.com/about/api-docs#trips_by_location
Retrieve a trip by either id or permalink as follows:
trazzler = TrazzlerApi::Trazzler.new trip = trazzler.get_trip(:id => 1) trip = trazzler.get_trip(:permalink => 'lauderdale-by-the-sea-florida') trip.content trip.url
You must specify either an ID or a permalink to use this method. Check the documentation here: api.trazzler.com/about/api-docs#get-trip
Fetch random Trazzler packages near a location.
trazzler = TrazzlerApi::Trazzler.new location = "San Francisco, CA" packages = trazzler.packages(location) packages.size # => 3 packages.first.deal # => The deal. packages.first.trips # => Three trips near the deal. location = "37.7749295,-122.4194155" packages = trazzler.packages(location, 1)
This method builds up and returns random Trazzler packages near a given location. By default three packages are created but this can be overridden with the second parameter to #packages.
A package contains one Trazzler deal and three Trazzler trips near that deal.
Copyright © 2010 Brian McManus.
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to unlicense.org