Class: MustardClient::ExecutionsClient

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

Instance Method Summary collapse

Methods inherited from Client

#execute, #initialize

Constructor Details

This class inherits a constructor from MustardClient::Client

Instance Method Details

#close(execution_id: nil, project_key: nil, new_execution_params: nil) ⇒ Object



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/MustardClient/executions.rb', line 130

def close execution_id: nil, project_key: nil, new_execution_params: nil

  if project_key
    route = "/executions/close?project_key=#{project_key}"
  else
    route = "/executions/close?execution_id=#{execution_id}"
  end

  command = {}
  command[:method] = :post
  command[:route] = @mustard_url + route
  command[:params] = {execution: new_execution_params} if new_execution_params
  command[:headers] = {'User-Token' => @user_token}

  execute(command)

end

#delete(execution_id) ⇒ Object



149
150
151
152
153
154
155
156
157
158
# File 'lib/MustardClient/executions.rb', line 149

def delete execution_id

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

  execute(command)

end

#environment_count(execution_id) ⇒ Object



94
95
96
97
98
99
100
101
102
103
# File 'lib/MustardClient/executions.rb', line 94

def environment_count execution_id

  command = {}
  command[:method] = :get
  command[:route] = @mustard_url + "/executions/#{execution_id}/environment-count"
  command[:headers] = {'User-Token' => @user_token}

  execute(command)

end

#environment_detail(execution_id, environment_id) ⇒ Object



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

def environment_detail execution_id, environment_id

  command = {}
  command[:method] = :get
  command[:route] = @mustard_url + "/executions/#{execution_id}/environment/#{environment_id}"
  command[:headers] = {'User-Token' => @user_token}

  execute(command)

end

#environment_summary(execution_id) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/MustardClient/executions.rb', line 42

def environment_summary execution_id

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

  execute(command)

end

#find(execution_id) ⇒ Object



106
107
108
109
110
111
112
113
114
115
# File 'lib/MustardClient/executions.rb', line 106

def find execution_id

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

  execute(command)

end

#incomplete_tests(execution_id, keywords: []) ⇒ Object



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/MustardClient/executions.rb', line 183

def incomplete_tests execution_id, keywords: []

  keywords = [keywords] unless keywords.kind_of? Array

  command = {}
  command[:method] = :get

  if keywords.blank?
    command[:route] = @mustard_url + "/executions/#{execution_id}/incomplete_tests"
  else
    keywords_string = keywords.map{|keyword| "keyword[]=#{keyword.upcase}"}.join('&')
    command[:route] = @mustard_url + "/executions/#{execution_id}/next_test?#{keywords_string}"
  end

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

  execute(command)

end

#keyword_summary(execution_id) ⇒ Object



54
55
56
57
58
59
60
61
62
63
# File 'lib/MustardClient/executions.rb', line 54

def keyword_summary execution_id

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

  execute(command)

end

#next_test(execution_id, keywords: [], environment: nil) ⇒ Object



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/MustardClient/executions.rb', line 160

def next_test execution_id, keywords: [], environment: nil

  keywords = [keywords] unless keywords.kind_of? Array

  command = {}
  command[:method] = :get
  keyword_string = ''
  keyword_string += keywords.map{|keyword| "keyword[]=#{keyword.upcase}"}.join('&') unless keywords.blank?
  keyword_string += "#{keyword_string != '' ? '&' : ''}environment=#{environment}"

  if keyword_string != ''
    command[:route] = @mustard_url + "/executions/#{execution_id}/next_test?#{keyword_string}"

  else
    command[:route] = @mustard_url + "/executions/#{execution_id}/next_test"
  end

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

  execute(command)

end

#testcase_count(execution_id) ⇒ Object



82
83
84
85
86
87
88
89
90
91
# File 'lib/MustardClient/executions.rb', line 82

def testcase_count execution_id

  command = {}
  command[:method] = :get
  command[:route] = @mustard_url + "/executions/#{execution_id}/testcase-count"
  command[:headers] = {'User-Token' => @user_token}

  execute(command)

end

#testcase_detail(execution_id, testcase_id) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/MustardClient/executions.rb', line 18

def testcase_detail execution_id, testcase_id

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

  execute(command)

end

#testcase_status(execution_id, format = nil) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/MustardClient/executions.rb', line 66

def testcase_status execution_id, format=nil

  command = {}
  command[:method] = :get
  if format
    command[:route] = @mustard_url + "/executions/#{execution_id}/testcase_status.#{format}"
  else
    command[:route] = @mustard_url + "/executions/#{execution_id}/testcase_status"
  end
  command[:headers] = {'User-Token' => @user_token}

  execute(command)

end

#testcase_summary(execution_id) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/MustardClient/executions.rb', line 30

def testcase_summary execution_id

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

  execute(command)

end

#update(execution_id, execution_params) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
# File 'lib/MustardClient/executions.rb', line 117

def update execution_id, execution_params

  command = {}
  command[:method] = :put
  command[:route] = @mustard_url + "/executions/#{execution_id}"
  command[:headers] = {'User-Token' => @user_token}
  command[:params] = {execution: execution_params}

  execute(command)

end