Sha256: f34eec1e7c9d4c88f8fa2460ddfbcc315203c6f674a3288af5efa3a06f1ef0f6

Contents?: true

Size: 1.21 KB

Versions: 14

Compression:

Stored size: 1.21 KB

Contents

module Kaya
  module API
    class Result
      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

      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

      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

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

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

      # def self.results_list

      # end

    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
kaya-0.0.14 lib/kaya/API/result.rb
kaya-0.0.13 lib/kaya/API/result.rb
kaya-0.0.12 lib/kaya/API/result.rb
kaya-0.0.11 lib/kaya/API/result.rb
kaya-0.0.10 lib/kaya/API/result.rb
kaya-0.0.9 lib/kaya/API/result.rb
kaya-0.0.8 lib/kaya/API/result.rb
kaya-0.0.7 lib/kaya/API/result.rb
kaya-0.0.6 lib/kaya/API/result.rb
kaya-0.0.5 lib/kaya/API/result.rb
kaya-0.0.4 lib/kaya/API/result.rb
kaya-0.0.3 lib/kaya/API/result.rb
kaya-0.0.2 lib/kaya/API/result.rb
kaya-0.0.1 lib/kaya/API/result.rb