Class: Datafiniti::Listings

Inherits:
Api
  • Object
show all
Defined in:
lib/datafiniti/listings.rb

Instance Attribute Summary collapse

Attributes inherited from Api

#conn, #status, #token

Instance Method Summary collapse

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

#formatObject

Returns the value of attribute format.



7
8
9
# File 'lib/datafiniti/listings.rb', line 7

def format
  @format
end

#previewObject (readonly)

Returns the value of attribute preview.



11
12
13
# File 'lib/datafiniti/listings.rb', line 11

def preview
  @preview
end

#recordsObject (readonly)

Returns the value of attribute records.



9
10
11
# File 'lib/datafiniti/listings.rb', line 9

def records
  @records
end

#responseObject

Returns the value of attribute response.



8
9
10
# File 'lib/datafiniti/listings.rb', line 8

def response
  @response
end

#totalObject (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