Class: MustardClient::TestcasesClient

Inherits:
Client
  • Object
show all
Defined in:
lib/MustardClient/testcases.rb

Instance Method Summary collapse

Methods inherited from Client

#execute, #initialize

Constructor Details

This class inherits a constructor from MustardClient::Client

Instance Method Details

#add(testcase_params, keyword_ids: false) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/MustardClient/testcases.rb', line 16

def add testcase_params, keyword_ids: false

  command = {}
  command[:method] = :post
  command[:route] = @mustard_url + "/testcases"

  if keyword_ids
    command[:params] = {testcase: testcase_params, keywords: keyword_ids}
  else
    command[:params] = {testcase: testcase_params}
  end

  command[:headers] = {'User-Token' => @user_token}

  execute(command)

end

#delete(testcase_id) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/MustardClient/testcases.rb', line 34

def delete testcase_id

  command = {}
  command[:method] = :delete
  command[:route] = @mustard_url + "/testcases/#{testcase_id}"
  command[:headers] = {'User-Token' => @user_token}

  execute(command)

end

#export(project_id) ⇒ Object



86
87
88
89
90
91
92
93
94
95
# File 'lib/MustardClient/testcases.rb', line 86

def export project_id

  command = {}
  command[:method] = :get
  command[:route] = @mustard_url + "/projects/#{project_id}/testcases/export.xlsx"
  command[:headers] = {'User-Token' => @user_token}

  execute(command)

end

#find(testcase_id) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/MustardClient/testcases.rb', line 5

def find testcase_id

  command = {}
  command[:method] = :get
  command[:route] = @mustard_url + "/testcases/#{testcase_id}"
  command[:headers] = {'User-Token' => @user_token}

  execute(command)

end

#import(project_id, json, preview: false, update: false) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/MustardClient/testcases.rb', line 62

def import project_id, json, preview: false, update: false

  command = {}
  command[:method] = :post
  command[:route] = @mustard_url + "/projects/#{project_id}/import"
  command[:headers] = {'User-Token' => @user_token}
  command[:params] = { update: update, json: json}

  execute(command)

end

#parse(project_id, file) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/MustardClient/testcases.rb', line 74

def parse project_id, file

  command = {}
  command[:method] = :post
  command[:route] = @mustard_url + "/projects/#{project_id}/parse"
  command[:headers] = {'User-Token' => @user_token}
  command[:params] = { file: file}

  execute(command)

end

#update(testcase_id, testcase_params, keyword_ids: false) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/MustardClient/testcases.rb', line 45

def update testcase_id, testcase_params, keyword_ids: false

  command = {}
  command[:method] = :put
  command[:route] = @mustard_url + "/testcases/#{testcase_id}"
  command[:headers] = {'User-Token' => @user_token}
  if keyword_ids
    command[:params] = {testcase: testcase_params, keywords: keyword_ids}
  else
    command[:params] = {testcase: testcase_params}
  end


  execute(command)

end