Class: Tc4r::BuildType

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Serializers::JSON
Defined in:
lib/tc4r/build_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, client) ⇒ BuildType

Returns a new instance of BuildType.



8
9
10
11
12
13
14
15
16
# File 'lib/tc4r/build_type.rb', line 8

def initialize(options = {},client)
  options = Tc4r::Helpers.symbolize(options)
  @id = options[:id]
  @name = options[:name]
  @project_name = options[:project_name] || options[:project][:name]
  @project_id = options[:project_id] || options[:project][:id]
  @href = options[:href] 
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/tc4r/build_type.rb', line 6

def client
  @client
end

#hrefObject (readonly)

Returns the value of attribute href.



6
7
8
# File 'lib/tc4r/build_type.rb', line 6

def href
  @href
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/tc4r/build_type.rb', line 6

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/tc4r/build_type.rb', line 6

def name
  @name
end

#project_idObject (readonly)

Returns the value of attribute project_id.



6
7
8
# File 'lib/tc4r/build_type.rb', line 6

def project_id
  @project_id
end

#project_nameObject (readonly)

Returns the value of attribute project_name.



6
7
8
# File 'lib/tc4r/build_type.rb', line 6

def project_name
  @project_name
end

Instance Method Details

#attributesObject



18
19
20
# File 'lib/tc4r/build_type.rb', line 18

def attributes
  { :id => @id, :name => @name, :project_name => @project_name, :project_id => @project_id, :href => @href }
end

#build(number) ⇒ Object



26
27
28
# File 'lib/tc4r/build_type.rb', line 26

def build(number)
  client.build(id,number)
end

#buildsObject



22
23
24
# File 'lib/tc4r/build_type.rb', line 22

def builds
  client.query_builds(id)
end