Class: MustardClient::Mustard

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url = 'localhost:8081', token = nil) ⇒ Mustard

Returns a new instance of Mustard.



23
24
25
26
# File 'lib/MustardClient.rb', line 23

def initialize(url= 'localhost:8081', token=nil)
  @mustard_url = url
  @user_token = token
end

Instance Attribute Details

#mustard_urlObject

Returns the value of attribute mustard_url.



18
19
20
# File 'lib/MustardClient.rb', line 18

def mustard_url
  @mustard_url
end

#user_tokenObject

Returns the value of attribute user_token.



18
19
20
# File 'lib/MustardClient.rb', line 18

def user_token
  @user_token
end

Instance Method Details

#authenticate(username, password) ⇒ Object



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

def authenticate(username, password)
  a = AuthenticateClient.new(@mustard_url, @user_token)
  r = a.authenticate(username, password)
  unless r['error']
    @user_token = r['user']['token']
  end

  return r
end

#environmentsObject



62
63
64
# File 'lib/MustardClient.rb', line 62

def environments
  EnvironmentsClient.new(@mustard_url, @user_token)
end

#executionsObject



70
71
72
# File 'lib/MustardClient.rb', line 70

def executions
  ExecutionsClient.new(@mustard_url, @user_token)
end

#keywordsObject



74
75
76
# File 'lib/MustardClient.rb', line 74

def keywords
  KeywordsClient.new(@mustard_url, @user_token)
end

#projectsObject



50
51
52
# File 'lib/MustardClient.rb', line 50

def projects
  ProjectsClient.new(@mustard_url, @user_token)
end

#resultsObject



66
67
68
# File 'lib/MustardClient.rb', line 66

def results
  ResultsClient.new(@mustard_url, @user_token)
end

#set_mustard_url(url) ⇒ Object



32
33
34
# File 'lib/MustardClient.rb', line 32

def set_mustard_url url
  @mustard_url = url
end

#set_user_token(token) ⇒ Object



28
29
30
# File 'lib/MustardClient.rb', line 28

def set_user_token token
  @user_token = token
end

#teamsObject



58
59
60
# File 'lib/MustardClient.rb', line 58

def teams
  TeamsClient.new(@mustard_url, @user_token)
end

#testcasesObject



54
55
56
# File 'lib/MustardClient.rb', line 54

def testcases
  TestcasesClient.new(@mustard_url, @user_token)
end

#usersObject



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

def users
  UsersClient.new(@mustard_url, @user_token)
end