Class: Base
- Inherits:
-
Object
show all
- Defined in:
- lib/anecdotally/query/base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(api, endpoint) ⇒ Base
Returns a new instance of Base.
3
4
5
6
|
# File 'lib/anecdotally/query/base.rb', line 3
def initialize(api, endpoint)
@api = api
@endpoint = endpoint
end
|
Instance Method Details
#find(filter) ⇒ Object
20
21
22
|
# File 'lib/anecdotally/query/base.rb', line 20
def find(filter)
@response = @api.execute(@endpoint, filter) || {}
end
|
#find_all ⇒ Object
12
13
14
|
# File 'lib/anecdotally/query/base.rb', line 12
def find_all()
@response = @api.execute(@endpoint) || {}
end
|
#find_by_id(_id) ⇒ Object
16
17
18
|
# File 'lib/anecdotally/query/base.rb', line 16
def find_by_id(_id)
@response = @api.execute(@endpoint, {:_id => _id}) || {}
end
|
#find_one ⇒ Object
8
9
10
|
# File 'lib/anecdotally/query/base.rb', line 8
def find_one()
@response = @api.execute(@endpoint, {:limit => 1}) || {}
end
|