Module: Twitter::API::PlacesAndGeo
Constant Summary
Constants included from Utils
Instance Method Summary collapse
-
#geo_search(options = {}) ⇒ Array<Twitter::Place>
(also: #places_nearby)
Search for places that can be attached to a Tweets#update.
-
#place(place_id, options = {}) ⇒ Twitter::Place
Returns all the information about a known place.
-
#place_create(options = {}) ⇒ Twitter::Place
Creates a new place at the given latitude and longitude.
-
#reverse_geocode(options = {}) ⇒ Array<Twitter::Place>
Searches for up to 20 places that can be used as a place_id.
-
#similar_places(options = {}) ⇒ Array<Twitter::Place>
(also: #places_similar)
Locates places near the given coordinates which are similar in name.
Instance Method Details
#geo_search(options = {}) ⇒ Array<Twitter::Place> Also known as: places_nearby
Search for places that can be attached to a Tweets#update
63 64 65 |
# File 'lib/twitter/api/places_and_geo.rb', line 63 def geo_search(={}) geo_objects_from_response(:get, "/1.1/geo/search.json", ) end |
#place(place_id, options = {}) ⇒ Twitter::Place
Returns all the information about a known place
20 21 22 |
# File 'lib/twitter/api/places_and_geo.rb', line 20 def place(place_id, ={}) object_from_response(Twitter::Place, :get, "/1.1/geo/id/#{place_id}.json", ) end |
#place_create(options = {}) ⇒ Twitter::Place
Creates a new place at the given latitude and longitude
105 106 107 |
# File 'lib/twitter/api/places_and_geo.rb', line 105 def place_create(={}) object_from_response(Twitter::Place, :post, "/1.1/geo/place.json", ) end |
#reverse_geocode(options = {}) ⇒ Array<Twitter::Place>
This request is an informative call and will deliver generalized results about geography.
Searches for up to 20 places that can be used as a place_id
40 41 42 |
# File 'lib/twitter/api/places_and_geo.rb', line 40 def reverse_geocode(={}) geo_objects_from_response(:get, "/1.1/geo/reverse_geocode.json", ) end |
#similar_places(options = {}) ⇒ Array<Twitter::Place> Also known as: places_similar
Conceptually, you would use this method to get a list of known places to choose from first. Then, if the desired place doesn't exist, make a request to #place to create a new one. The token contained in the response is the token necessary to create a new place.
Locates places near the given coordinates which are similar in name
84 85 86 |
# File 'lib/twitter/api/places_and_geo.rb', line 84 def similar_places(={}) geo_objects_from_response(:get, "/1.1/geo/similar_places.json", ) end |