Sha256: 2683651b4cdb668218ec7d97c544ac2e6ea529ba0de6c1099d737d9469b94a96

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

module Kaya
  module API
    module Suites

      # @param [hash] options = {:running, :active}
      def self.list(options ={})

        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
          start = Time.now.to_f
          response["suites"] = suites.map{|suite_id| Kaya::Suites::Suite.get(suite_id).api_response}
          $K_LOG.debug "#{suites.size} retrieved in (#{Time.now.to_f - start} s)" if $K_LOG

          response["size"] = suites.size
        end
        response
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kaya-0.0.9 lib/kaya/API/suites.rb
kaya-0.0.8 lib/kaya/API/suites.rb
kaya-0.0.7 lib/kaya/API/suites.rb
kaya-0.0.6 lib/kaya/API/suites.rb
kaya-0.0.5 lib/kaya/API/suites.rb
kaya-0.0.4 lib/kaya/API/suites.rb