Module: Mutx::API::Results
- Defined in:
- lib/mutx/API/results.rb
Class Method Summary collapse
- .find_by_key(keyword) ⇒ Object
- .for_task_id(task_id) ⇒ Object
- .show(options = {}) ⇒ Object
- .structure ⇒ Object
Class Method Details
.find_by_key(keyword) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/mutx/API/results.rb', line 15 def self.find_by_key keyword response = self.structure response["results"] = Mutx::Results.find_for(keyword).map{|result| Mutx::API::Result.info(result["_id"])} response["message"] = "No results found" if (response["size"] = response["results"].size).zero? response end |
.for_task_id(task_id) ⇒ Object
30 31 32 33 34 |
# File 'lib/mutx/API/results.rb', line 30 def self.for_task_id task_id response = self.structure response["results"] = Mutx::Results.all_results_for(task_id).map{|result| Mutx::API::Result.info(result["_id"])} response end |
.show(options = {}) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/mutx/API/results.rb', line 7 def self.show( = {}) response = self.structure response["results"] = Mutx::Results.all_results.map{|result| Mutx::API::Result.info(result["_id"])} response["message"] = "No results found" if (response["size"] = response["results"].size).zero? response end |
.structure ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/mutx/API/results.rb', line 22 def self.structure response = { "project_name" => Dir.pwd.split("/").last, "results" => [] } response end |