Class: Bamboo::Client::Remote

Inherits:
Abstract
  • Object
show all
Defined in:
lib/bamboo-client/remote.rb

Overview

Client for the legacy Bamboo Remote API

confluence.atlassian.com/display/BAMBOO/Bamboo+Remote+API

Defined Under Namespace

Classes: Build, BuildResult

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ Remote

Returns a new instance of Remote.



13
14
15
16
# File 'lib/bamboo-client/remote.rb', line 13

def initialize(http)
  super
  @service = "/api/rest"
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



11
12
13
# File 'lib/bamboo-client/remote.rb', line 11

def token
  @token
end

Instance Method Details

#buildsObject



45
46
47
48
49
# File 'lib/bamboo-client/remote.rb', line 45

def builds
  doc = post :listBuildNames, :auth => token

  doc.objects_for "build", Remote::Build, self
end

#execute_build(build_key) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/bamboo-client/remote.rb', line 37

def execute_build(build_key)
  doc = post :executeBuild,
             :auth     => token,
             :buildKey => build_key

  doc.text_for "response string"
end

#latest_build_results(build_key) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/bamboo-client/remote.rb', line 59

def latest_build_results(build_key)
  doc = post :getLatestBuildResults,
             :auth     => token,
             :buildKey => build_key

  doc.object_for "response", Remote::BuildResult
end

#latest_builds_for(user) ⇒ Object



51
52
53
54
55
56
57
# File 'lib/bamboo-client/remote.rb', line 51

def latest_builds_for(user)
  doc = post :getLatestUserBuilds,
             :auth => token,
             :user => user

  doc.objects_for "build", Remote::Build, self
end

#login(user, pass) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/bamboo-client/remote.rb', line 18

def (user, pass)
  doc = post :login,
             :username => user,
             :password => pass

  @token = doc.text_for "response auth"
end

#logoutObject



26
27
28
29
# File 'lib/bamboo-client/remote.rb', line 26

def logout
  post :logout, :auth => token
  @token = nil
end

#recently_completed_results_for_build(build_key) ⇒ Object



75
76
77
78
79
80
81
# File 'lib/bamboo-client/remote.rb', line 75

def recently_completed_results_for_build(build_key)
  doc = post :getRecentlyCompletedBuildResultsForBuild,
             :auth       => token,
             :buildKey => build_key

  doc.objects_for "build", Remote::BuildResult
end

#recently_completed_results_for_project(project_key) ⇒ Object



67
68
69
70
71
72
73
# File 'lib/bamboo-client/remote.rb', line 67

def recently_completed_results_for_project(project_key)
  doc = post :getRecentlyCompletedBuildResultsForProject,
             :auth       => token,
             :projectKey => project_key

  doc.objects_for "build", Remote::BuildResult
end

#update_and_build(build_name) ⇒ Object



31
32
33
34
35
# File 'lib/bamboo-client/remote.rb', line 31

def update_and_build(build_name)
  doc = post :updateAndBuild, :buildName => build_name

  doc.text_for "response success"
end