Class: Scirocco::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/scirocco/cli.rb

Instance Method Summary collapse

Instance Method Details

#check_test(test_job_id) ⇒ Object



44
45
46
47
# File 'lib/scirocco/cli.rb', line 44

def check_test(test_job_id)
  client = Scirocco::Client.new(options[:api_key], options)
  pp client.check_test(test_job_id)
end

#devices(project_id) ⇒ Object



50
51
52
53
# File 'lib/scirocco/cli.rb', line 50

def devices(project_id)
  client = Scirocco::Client.new(options[:api_key], options)
  pp client.devices(project_id)
end

#projectsObject



12
13
14
15
# File 'lib/scirocco/cli.rb', line 12

def projects
  client = Scirocco::Client.new(options[:api_key], options)
  pp client.projects()
end

#run_test(test_class_id, device_id) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/scirocco/cli.rb', line 25

def run_test(test_class_id, device_id)
  client = Scirocco::Client.new(options[:api_key], options)
  test_job = client.run_test(test_class_id, device_id)
  puts "* test_job:"
  pp test_job
  if options[:poll]
    test_status = client.poll_test_result(test_job["test_job_id"])
    if test_status["status"] == "passed"
      puts "**** PASSED ****"
      pp test_status
    elsif test_status["status"] == "failed"
      puts "**** FAILED ****"
      pp test_status
      raise SciroccoTestError.new(test_status["result"])
    end
  end
end

#tests(project_id) ⇒ Object



18
19
20
21
# File 'lib/scirocco/cli.rb', line 18

def tests(project_id)
  client = Scirocco::Client.new(options[:api_key], options)
  pp client.tests(project_id)
end