Class: Testrail::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/tagrail/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Client

Returns a new instance of Client.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tagrail/client.rb', line 17

def initialize(args)
  @projects = nil
  @sections = Hash.new
  @suite   = Hash.new
  @suites   = []

  @client = APIClient.new args[:url]
  %w(user password project_id).each do |key|
    raise Exception.new("TestRail configuration key :#{key} not set. Cannot continue without it.") if args[key.intern].nil?
    @client.send "#{key}=", args[key.intern] if %w(user password).include? key
  end
end

Instance Method Details

#add_result_for_case(run_id, case_id, result) ⇒ Object

results



41
42
43
# File 'lib/tagrail/client.rb', line 41

def add_result_for_case(run_id, case_id, result)
  @client.send_post("add_result_for_case/#{run_id}/#{case_id}", result)
end

#add_run(project_id, suite_id, run_name) ⇒ Object



30
31
32
33
# File 'lib/tagrail/client.rb', line 30

def add_run(project_id, suite_id, run_name)
  @client.send_post("add_run/#{project_id}", { suite_id: suite_id,
                                               name: run_name })
end

#get_case(case_id) ⇒ Object

cases



36
37
38
# File 'lib/tagrail/client.rb', line 36

def get_case(case_id)
  @client.send_get("get_case/#{case_id}")
end

#get_project(project_id) ⇒ Object

projects



46
47
48
# File 'lib/tagrail/client.rb', line 46

def get_project(project_id)
  @client.send_get("get_project/#{project_id}")
end