Class: Codestatus::BuildStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/codestatus/build_status.rb

Constant Summary collapse

UNDEFINED =
'undefined'.freeze
ERROR =

Defined in GitHub

'error'.freeze
FAILURE =
'failure'.freeze
PENDING =
'pending'.freeze
SUCCESS =
'success'.freeze
STATUSES =

Statuses defined in Bitbucket are mapped into GitHub’s status

STOPPED    => ERROR
FAILED     => FAILURE
INPROGRESS => PENDING
SUCCESSFUL => SUCCESS
[
  ERROR,
  FAILURE,
  PENDING,
  SUCCESS,
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sha:, status:) ⇒ BuildStatus

Returns a new instance of BuildStatus.



24
25
26
27
28
29
30
31
32
# File 'lib/codestatus/build_status.rb', line 24

def initialize(sha:, status:)
  @sha = sha

  if STATUSES.include?(status.to_s)
    @status = status.to_s
  else
    @status = UNDEFINED
  end
end

Instance Attribute Details

#shaObject (readonly)

Returns the value of attribute sha.



34
35
36
# File 'lib/codestatus/build_status.rb', line 34

def sha
  @sha
end

#statusObject (readonly)

Returns the value of attribute status.



34
35
36
# File 'lib/codestatus/build_status.rb', line 34

def status
  @status
end