Class: Factual::Query::Facets

Inherits:
Base
  • Object
show all
Defined in:
lib/factual/query/facets.rb

Constant Summary collapse

DEFAULT_LIMIT =
20
VALID_PARAMS =
[
  :filters, :search, :geo, 
  :select, 
  :limit, :min_count,
  :include_count
]

Instance Attribute Summary

Attributes inherited from Base

#action, #params, #path

Instance Method Summary collapse

Methods inherited from Base

#full_path, #last, #populate, #rows, #schema, #total_count

Constructor Details

#initialize(api, path, params = {}) ⇒ Facets

Returns a new instance of Facets.



14
15
16
17
18
# File 'lib/factual/query/facets.rb', line 14

def initialize(api, path, params = {})
  @path = path
  @action = :facets
  super(api, params)
end

Instance Method Details

#[](col) ⇒ Object



32
33
34
# File 'lib/factual/query/facets.rb', line 32

def [](col)
  columns[col]
end

#columnsObject



36
37
38
# File 'lib/factual/query/facets.rb', line 36

def columns
  response["data"]
end

#each(&block) ⇒ Object



26
27
28
29
30
# File 'lib/factual/query/facets.rb', line 26

def each(&block)
  columns.each do |col, data|
    block.call(col, data)
  end
end