Class: Papertrail::SearchQuery
- Inherits:
-
Object
- Object
- Papertrail::SearchQuery
- Defined in:
- lib/papertrail/search_query.rb
Instance Method Summary collapse
-
#initialize(connection, query = nil, options = {}) ⇒ SearchQuery
constructor
A new instance of SearchQuery.
- #search ⇒ Object
Constructor Details
#initialize(connection, query = nil, options = {}) ⇒ SearchQuery
Returns a new instance of SearchQuery.
5 6 7 8 9 |
# File 'lib/papertrail/search_query.rb', line 5 def initialize(connection, query = nil, = {}) @connection = connection @query = query @options = end |
Instance Method Details
#search ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/papertrail/search_query.rb', line 11 def search params = @options.dup params[:q] = @query if @query params[:min_id] = @max_id if @max_id response = @connection.get('/api/v1/events/search.json', params) @max_id = response.body['max_id'] Papertrail::SearchResult.new(response.body) end |