Class: MustardClient::KeywordsClient

Inherits:
Client
  • Object
show all
Defined in:
lib/MustardClient/keywords.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(keyword_params, testcase_ids: false) ⇒ Object



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

def add keyword_params, testcase_ids: false

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

  if testcase_ids
    command[:params] = {keyword: keyword_params, testcases: testcase_ids}
  else
    command[:params] = {keyword: keyword_params}
  end

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

  execute(command)

end

#delete(keyword_id) ⇒ Object



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

def delete keyword_id

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

  execute(command)

end

#find(keyword_id) ⇒ Object



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

def find keyword_id

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

  execute(command)

end

#update(keyword_id, keyword_params, testcase_ids: false) ⇒ Object



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

def update keyword_id, keyword_params, testcase_ids: false

  command = {}
  command[:method] = :put
  command[:route] = @mustard_url + "/keywords/#{keyword_id}"
  command[:headers] = {'User-Token' => @user_token}

  if testcase_ids
    command[:params] = {keyword: keyword_params, testcases: testcase_ids}
  else
    command[:params] = {keyword: keyword_params}
  end

  execute(command)

end