Ruby Wrapper Library for Teleportd API
Currently, this wrapper only supports the basic search functionality.
Add this line to your application's Gemfile:
gem 'teleportd'
And then execute:
$ bundle
Or install it yourself as:
$ gem install teleportd
NOTE: You must set an ENV variable 'TELEPORTD_API_KEY' for your Teleportd API key
$ export TELEPORTD_API_KEY=$APIKEY
Create an instance of a Teleportd::Search with optional filters. The Search returns an enumerable collection of Teleportd::SearchResult objects
Query With Locations:
$ options = {}
$ options[:location] = {}
$ options[:location][:latitude] = 34.19
$ options[:location][:longitude] = -119.49
$ options[:location][:vertical] = 5.0
$ options[:location][:horizontal] = 5.0
$ search = Teleportd::Search.new(options)
Query With Textual Search:
$ options = {}
$ options[:textual_search] = 'foo bar baz'
$ search = Teleportd::Search.new(options)
Query With Time Period (start/end)
$ options = {}
$ options[:time_period] = {}
$ options[:time_period][:start_time] = 5.days.ago
$ options[:time_period][:end_time] = 2.days.ago
$ search = Teleportd::Search.new(options)
Query With Sort (relevance/recency)
$ options = {}
$ options[:sort] = 'relevance'
$ search = Teleportd::Search.new(options)
Options can be combined, of course:
$ options = {}
$ options[:location] = {}
$ options[:location][:latitude] = 34.19
$ options[:location][:longitude] = -119.49
$ options[:location][:vertical] = 5.0
$ options[:location][:horizontal] = 5.0
$ options[:time_period] = {}
$ options[:time_period][:start_time] = 5.days.ago
$ options[:time_period][:end_time] = 2.days.ago
$ options[:textual_search] = 'foo bar baz'
$ search = Teleportd::Search.new(options)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request