6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/kaya/API/suites.rb', line 6
def self.list(options ={})
start = Time.now.to_f
response = {
"project_name" => Dir.pwd.split("/").last,
"size" => 0,
"suites" => [],
"message" => nil
}
suites = if options[:running]
response["request"] = "Running Suites"
Kaya::Suites.all_running_suites
else
response["request"] = options[:active] ? "Active Suites" : "Suites"
Kaya::Suites.suite_ids options[:active]
end
if suites.size.zero?
response["message"] = options[:running] ? "No running suites found" : "No suites found"
else
suites = suites.map{|suite_id| Kaya::Suites::Suite.get(suite_id).api_response}
suites = suites.map do |suite|
unless Kaya::Results.results_for_suite_id_and_ip(suite["_id"], options[:ip]).empty?
suite["status"]="RUNNING"
suite
else
suite
end
end
response["suites"] = suites
$K_LOG.debug "#{suites.size} retrieved in (#{Time.now.to_f - start} s)" if $K_LOG
response["size"] = suites.size
end
response
end
|