Class: Datafiniti::Listings
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
-
#preview ⇒ Object
readonly
Returns the value of attribute preview.
-
#records ⇒ Object
readonly
Returns the value of attribute records.
-
#response ⇒ Object
Returns the value of attribute response.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Attributes inherited from Api
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Listings
constructor
A new instance of Listings.
- #solr_query(query) ⇒ Object
- #where(query) ⇒ Object
Methods inherited from Api
#default_to_csv, #default_to_json, #download, #method_missing
Constructor Details
#initialize(args = {}) ⇒ Listings
Returns a new instance of Listings.
13 14 15 16 |
# File 'lib/datafiniti/listings.rb', line 13 def initialize(args={}) @format = "json" super(args) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Datafiniti::Api
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format.
7 8 9 |
# File 'lib/datafiniti/listings.rb', line 7 def format @format end |
#preview ⇒ Object (readonly)
Returns the value of attribute preview.
11 12 13 |
# File 'lib/datafiniti/listings.rb', line 11 def preview @preview end |
#records ⇒ Object (readonly)
Returns the value of attribute records.
9 10 11 |
# File 'lib/datafiniti/listings.rb', line 9 def records @records end |
#response ⇒ Object
Returns the value of attribute response.
8 9 10 |
# File 'lib/datafiniti/listings.rb', line 8 def response @response end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
10 11 12 |
# File 'lib/datafiniti/listings.rb', line 10 def total @total end |
Instance Method Details
#solr_query(query) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/datafiniti/listings.rb', line 25 def solr_query(query) query = build_new_query(query, true) @response = get("/v2/data/locations/preview?view=portal_business_listings_json&q=#{query}") update_records return @response end |
#where(query) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/datafiniti/listings.rb', line 18 def where(query) query = build_new_query(query) @response = get("/v2/data/locations/preview?view=portal_business_listings_json&q=#{query}") update_records return @response end |