Module: TeamCity::Client::Builds

Included in:
TeamCity::Client
Defined in:
lib/teamcity/client/builds.rb

Overview

Defines methods related to builds

Instance Method Summary collapse

Instance Method Details

#build(options = {}) ⇒ Hashie::Mash

Get build details



22
23
24
25
# File 'lib/teamcity/client/builds.rb', line 22

def build(options={})
  assert_options(options)
  get("builds/#{locator(options)}")
end

#build_artifacts(build_id) ⇒ Array<Hashie::Mash>

Get build artifacts



60
61
62
63
# 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) ⇒ Boolean

Tells you whether or not a build is pinned



50
51
52
53
54
# 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) ⇒ Array<Hashie::Mash>

Get build statistics



41
42
43
44
# 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 = {}) ⇒ Array<Hashie::Mash>

Get the build tags



31
32
33
34
35
# 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 = {}) ⇒ Array<Hashie::Mash>

List of builds



12
13
14
15
16
# 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 = '') ⇒ nil

Pin a build



72
73
74
75
76
77
78
# 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) ⇒ nil

Unpin a build



86
87
88
89
# File 'lib/teamcity/client/builds.rb', line 86

def unpin_build(id)
  path = "builds/#{id}/pin"
  delete(path, :content_type => :text)
end