Class: TrackerApi::Endpoints::Search
- Defined in:
- lib/tracker_api/endpoints/search.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #get(project_id, query, options = {}) ⇒ Object
-
#initialize(client) ⇒ Search
constructor
A new instance of Search.
Constructor Details
#initialize(client) ⇒ Search
Returns a new instance of Search.
6 7 8 |
# File 'lib/tracker_api/endpoints/search.rb', line 6 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/tracker_api/endpoints/search.rb', line 4 def client @client end |
Instance Method Details
#get(project_id, query, options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/tracker_api/endpoints/search.rb', line 10 def get(project_id, query, ={}) raise ArgumentError, 'Valid query string required to search' unless query.is_a?(String) [:params] = { query: query } data = client.get("/projects/#{project_id}/search", ).body raise Errors::UnexpectedData, 'Hash of search results expect' unless data.is_a? Hash Resources::SearchResultContainer.new(data) end |