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,
  :threshold,
  :include_count, :user
]

Instance Attribute Summary

Attributes inherited from Base

#action, #params, #path

Instance Method Summary collapse

Methods inherited from Base

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

Constructor Details

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

Returns a new instance of Facets.



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

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

Instance Method Details

#[](col) ⇒ Object



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

def [](col)
  columns[col]
end

#columnsObject



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

def columns
  response["data"]
end

#each(&block) ⇒ Object



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

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