lib/bamboo-client/remote.rb in bamboo-client-0.0.1 vs lib/bamboo-client/remote.rb in bamboo-client-0.0.2
- old
+ new
@@ -18,11 +18,11 @@
def login(user, pass)
doc = post :login,
:username => user,
:password => pass
- @token = doc.text_for("response auth")
+ @token = doc.text_for "response auth"
end
def logout
post :logout, :token => token
@token = nil
@@ -43,19 +43,19 @@
end
def builds
doc = post :listBuildNames, :auth => token
- doc.objects_for "build", Remote::Build
+ doc.objects_for "build", Remote::Build, self
end
def latest_builds_for(user)
doc = post :getLatestUserBuilds,
:auth => token,
:user => user
- doc.objects_for "build", Remote::Build
+ doc.objects_for "build", Remote::Build, self
end
def latest_build_results(build_key)
doc = post :getLatestBuildResults,
:auth => token,
@@ -89,12 +89,13 @@
#
# types
#
class Build
- def initialize(doc)
+ def initialize(doc, client)
@doc = doc
+ @client = client
end
def enabled?
@doc['enabled'] == 'true'
end
@@ -103,9 +104,25 @@
@doc.css("name").text
end
def key
@doc.css("key").text
+ end
+
+ def latest_results
+ @client.latest_build_results key
+ end
+
+ def execute
+ @client.execute_build(key)
+ end
+
+ def update_and_build
+ @client.update_and_build(key)
+ end
+
+ def recently_completed_results
+ @client.recently_completed_results_for_build(key)
end
end
class BuildResult
def initialize(doc)