Class: CcTray::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/cctray/project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Project

Returns a new instance of Project.



5
6
7
# File 'lib/cctray/project.rb', line 5

def initialize(data)
  import(data)
end

Instance Attribute Details

#activityObject

Returns the value of attribute activity.



3
4
5
# File 'lib/cctray/project.rb', line 3

def activity
  @activity
end

#lastBuildLabelObject

Returns the value of attribute lastBuildLabel.



3
4
5
# File 'lib/cctray/project.rb', line 3

def lastBuildLabel
  @lastBuildLabel
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/cctray/project.rb', line 3

def name
  @name
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/cctray/project.rb', line 3

def status
  @status
end

#timeObject

Returns the value of attribute time.



3
4
5
# File 'lib/cctray/project.rb', line 3

def time
  @time
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/cctray/project.rb', line 3

def url
  @url
end

Instance Method Details

#building?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/cctray/project.rb', line 18

def building?
  activity == 'Building'
end

#failure?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/cctray/project.rb', line 30

def failure?
  status == 'Failure'
end

#import(data) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/cctray/project.rb', line 9

def import(data)
  self.name           = data[:name]
  self.url            = data[:webUrl]
  self.time           = data[:lastBuildTime]
  self.status         = data[:lastBuildStatus]
  self.lastBuildLabel = data[:lastBuildLabel]
  self.activity       = data[:activity]
end

#sleeping?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/cctray/project.rb', line 22

def sleeping?
  activity == 'Sleeping'
end

#success?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/cctray/project.rb', line 26

def success?
  status == 'Success'
end