module TeamCity::Client::Builds

Defines methods related to builds

Public Instance Methods

build(options={}) click to toggle source

Get build details

@param options [Hash] option keys, :id => build_id @return [Hashie::Mash] of build details

# File lib/teamcity/client/builds.rb, line 22
def build(options={})
  assert_options(options)
  get("builds/#{locator(options)}")
end
build_artifacts(build_id) click to toggle source

Get build artifacts

@param build_id [String] @return [Array<Hashie::Mash>]

# File lib/teamcity/client/builds.rb, line 60
def build_artifacts(build_id)
  response = get("builds/#{build_id}/artifacts")
  response['files']
end
build_pinned?(id) click to toggle source

Tells you whether or not a build is pinned

@param id [String] build to check if it is pinned @return [Boolean] whether the build is pinned or not

# File lib/teamcity/client/builds.rb, line 50
def build_pinned?(id)
  path = "builds/#{id}/pin"
  response = get(path, :accept => :text, :content_type => :text)
  response == 'true'
end
build_statistics(build_id) click to toggle source

Get build statistics

@param build_id [String] @return [Array<Hashie::Mash>]

# File lib/teamcity/client/builds.rb, line 41
def build_statistics(build_id)
  response = get("builds/#{build_id}/statistics")
  response['property']
end
build_tags(options={}) click to toggle source

Get the build tags

@param options [Hash] option keys, :id => build_id @return [Array<Hashie::Mash>] or empty array if no tags exist

# File lib/teamcity/client/builds.rb, line 31
def build_tags(options={})
  assert_options(options)
  response = get("builds/#{locator(options)}/tags")
  response.fetch(:tag)
end
builds(options={}) click to toggle source

List of builds

@param options [Hash] list of build locators to filter build results on @return [Array<Hashie::Mash>] of builds (empty array if no builds exist)

# File lib/teamcity/client/builds.rb, line 12
def builds(options={})
  url_params = options.empty? ? '' : "?locator=#{locator(options)}"
  response = get("builds#{url_params}")
  response.build
end
pin_build(id, comment='') click to toggle source

Pin a build

@param id [String] build to pin @param comment [String] provide a comment to the pin @return [nil]

# File lib/teamcity/client/builds.rb, line 72
def pin_build(id, comment='')
  path = "builds/#{id}/pin"
  put(path, :accept => :text, :content_type => :text) do |req|
    req.body = comment
  end
  return nil
end
unpin_build(id) click to toggle source

Unpin a build

@param id [String] build to unpin @return [nil]

# File lib/teamcity/client/builds.rb, line 86
def unpin_build(id)
  path = "builds/#{id}/pin"
  delete(path, :content_type => :text)
end