Class: Factual::Places
- Inherits:
-
Object
- Object
- Factual::Places
- Defined in:
- lib/factual/places.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client) ⇒ Places
constructor
A new instance of Places.
-
#search_table(table_id, optional = {}) ⇒ Object
developer.factual.com/display/docs/Core+API+-+Read Optional parameters: filters: developer.factual.com/display/docs/Core+API+-+Row+Filters include_count: default is false facet: comma seperated list of fields; returns counts grouped by distinct fields geo: send a hash => lat, :longitude => lng, :radius => rad limit: default is 20, max is 50 q: full-text search, “sushi bar” searches for sushi AND bar; “sushi,bar” searches sushi OR bar offset select: fields to include in the query response sort: field_name:(asc|desc), $distance:(asc|desc), or $relevance:(asc|desc).
Constructor Details
#initialize(client) ⇒ Places
Returns a new instance of Places.
6 7 8 |
# File 'lib/factual/places.rb', line 6 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/factual/places.rb', line 4 def client @client end |
Instance Method Details
#search_table(table_id, optional = {}) ⇒ Object
developer.factual.com/display/docs/Core+API+-+Read Optional parameters:
filters: http://developer.factual.com/display/docs/Core+API+-+Row+Filters
include_count: default is false
facet: comma seperated list of fields; returns counts grouped by distinct fields
geo: send a hash {:latitude => lat, :longitude => lng, :radius => rad}
limit: default is 20, max is 50
q: full-text search, "sushi bar" searches for sushi AND bar; "sushi,bar" searches sushi OR bar
offset
select: fields to include in the query response
sort: field_name:(asc|desc), $distance:(asc|desc), or $relevance:(asc|desc)
22 23 24 25 |
# File 'lib/factual/places.rb', line 22 def search_table(table_id, optional = {}) optional[:geo] = create_geo_filter(optional[:geo]) if optional[:geo].exists? PlacesResponse.new(@client.class.get("/t/#{table_id}", :query => optional)) end |