class StudioApi::RunningBuild

Represents running build in studio.

Provide finding builds, canceling build process or running new build For parameters see API documentation @example Run new build and then cancel it

rb = StudioApi::RunningBuild.new(:appliance_id => 1234, :force => "true", :multi => "true")
rb.save!
sleep 5
rb.cancel

An ImageAlreadyExists exception is raised when force parameter is not specified and there's already a build with the same version.

Private Instance Methods

create() click to toggle source

overwrite create as studio doesn't interact well with enclosed parameters

   # File lib/studio_api/running_build.rb
27 def create
28   request_str = collection_path
29   request_str << "?appliance_id=#{attributes.delete("appliance_id").to_i}"
30   attributes.each do |k,v|
31     request_str << "&#{CGI.escape k.to_s}=#{CGI.escape v.to_s}"
32   end
33   connection.post(request_str,"",self.class.headers).tap do |response|
34     load_attributes_from_response response
35   end
36 rescue ActiveResource::BadRequest => e
37   tree = XmlSimple.xml_in(e.response.body)
38   code = tree["code"][0]
39   if code == "image_already_exists"
40     message = tree["message"][0]
41     raise ImageAlreadyExists.new message
42   else
43     raise e
44   end
45 end