Class: Factual::Query::Base
- Inherits:
-
Object
- Object
- Factual::Query::Base
show all
- Includes:
- Enumerable
- Defined in:
- lib/factual/query/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(api, params) ⇒ Base
Returns a new instance of Base.
6
7
8
9
|
# File 'lib/factual/query/base.rb', line 6
def initialize(api, params)
@api = api
@params = params
end
|
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
11
12
13
|
# File 'lib/factual/query/base.rb', line 11
def action
@action
end
|
#params ⇒ Object
Returns the value of attribute params.
11
12
13
|
# File 'lib/factual/query/base.rb', line 11
def params
@params
end
|
#path ⇒ Object
Returns the value of attribute path.
11
12
13
|
# File 'lib/factual/query/base.rb', line 11
def path
@path
end
|
Instance Method Details
#[](index) ⇒ Object
21
22
23
|
# File 'lib/factual/query/base.rb', line 21
def [](index)
rows[index]
end
|
#each(&block) ⇒ Object
13
14
15
|
# File 'lib/factual/query/base.rb', line 13
def each(&block)
rows.each { |row| block.call(row) }
end
|
#last ⇒ Object
17
18
19
|
# File 'lib/factual/query/base.rb', line 17
def last
rows.last
end
|
#rows ⇒ Object
25
26
27
|
# File 'lib/factual/query/base.rb', line 25
def rows
response["data"]
end
|
#schema ⇒ Object
33
34
35
|
# File 'lib/factual/query/base.rb', line 33
def schema
@schema ||= @api.schema(self)
end
|
#total_rows ⇒ Object
29
30
31
|
# File 'lib/factual/query/base.rb', line 29
def total_rows
response["total_row_count"]
end
|