Class: Kaya::API::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/kaya/API/result.rb

Class Method Summary collapse

Class Method Details

.data(result_id) ⇒ Object



33
34
35
36
# File 'lib/kaya/API/result.rb', line 33

def self.data result_id
  result = self.info result_id
  {"type" => "result", "_id" => result["_id"], "status" => result["status"], "execution_data" => result["execution_data"]}
end

.get_for_suite(suite_id) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/kaya/API/result.rb', line 4

def self.get_for_suite(suite_id)
  suite = Kaya::Suites::Suite.get(suite_id)
  if suite
    {
      "project_name" => Dir.pwd.split("/").last,
      "suite" => {id:suite.id, name:suite.name},
      "results" => results_list_for(suite.id)
    }
  else
    {"results" => results_list}
  end
end

.info(result_id) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/kaya/API/result.rb', line 24

def self.info(result_id)
  result = Kaya::Results::Result.get(result_id)
  if result
    result.api_response
  else
    {"message" => "Result #{result_id} not found"}
  end
end

.results_list_for(suite_id) ⇒ Object



17
18
19
20
21
22
# File 'lib/kaya/API/result.rb', line 17

def self.results_list_for(suite_id)
  suite_results = Kaya::Results.results_ids_for(suite_id)
  suite_results.map do |result_id|
    info(result_id)
  end
end

.status(result_id) ⇒ Object



38
39
40
41
# File 'lib/kaya/API/result.rb', line 38

def self.status result_id
  result = self.info result_id
  {"type" => "result", "status" => result["status"]}
end