Class: VetCI::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/vet-ci/build.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Build

Returns a new instance of Build.



14
15
16
17
18
# File 'lib/vet-ci/build.rb', line 14

def initialize(attributes = {})
  attributes.each do |key, value|
    self.send("#{key}=", value)
  end
end

Instance Attribute Details

#commitObject

Returns the value of attribute commit.



4
5
6
# File 'lib/vet-ci/build.rb', line 4

def commit
  @commit
end

#committerObject

Returns the value of attribute committer.



4
5
6
# File 'lib/vet-ci/build.rb', line 4

def committer
  @committer
end

#dateObject

Returns the value of attribute date.



4
5
6
# File 'lib/vet-ci/build.rb', line 4

def date
  @date
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/vet-ci/build.rb', line 4

def id
  @id
end

#outputObject

Returns the value of attribute output.



4
5
6
# File 'lib/vet-ci/build.rb', line 4

def output
  @output
end

#payloadObject

Returns the value of attribute payload.



4
5
6
# File 'lib/vet-ci/build.rb', line 4

def payload
  @payload
end

#projectObject

Returns the value of attribute project.



4
5
6
# File 'lib/vet-ci/build.rb', line 4

def project
  @project
end

#statusObject

Returns the value of attribute status.



4
5
6
# File 'lib/vet-ci/build.rb', line 4

def status
  @status
end

Instance Method Details

#commit_infoObject



20
21
22
23
# File 'lib/vet-ci/build.rb', line 20

def commit_info
  commit = self.project.repo.commit(self.commit)
  commit.nil? ? nil : commit.to_hash
end

#dashboard_timeObject



37
38
39
# File 'lib/vet-ci/build.rb', line 37

def dashboard_time
  self.date.strftime('%D @ %r')
end

#friendly_timeObject



33
34
35
# File 'lib/vet-ci/build.rb', line 33

def friendly_time
  self.date.strftime('%A, %B %e, %Y at %I:%M %p')
end

#status_classObject



25
26
27
28
29
30
31
# File 'lib/vet-ci/build.rb', line 25

def status_class
  if self.status == 0
    'passed'
  else
    'failed'
  end
end