class StashNotifier::BuildResult

Constants

VALID_BUILD_STATES

Attributes

description[RW]
key[RW]
name[RW]
state[R]
url[RW]

Public Class Methods

new(args) click to toggle source
# File lib/stash_notifier/build_result.rb, line 24
def initialize(args)
  self.state   = args[:state]
  @key         = args[:key]
  @name        = args[:name]
  @url         = args[:url]
  @description = args[:description]
end

Public Instance Methods

state=(new_state) click to toggle source
# File lib/stash_notifier/build_result.rb, line 32
def state=(new_state)
  new_state = new_state.upcase
  if VALID_BUILD_STATES.include?(new_state)
    @state = new_state
  else
    raise ArgumentError, "'#{new_state}' is not a valid Stash Build state! Valid states are #{VALID_BUILD_STATES}."
  end
end
to_json() click to toggle source
# File lib/stash_notifier/build_result.rb, line 41
def to_json
  result = {
    state:       state,
    key:         key,
    name:        name,
    url:         url,
    description: description
  }
  result.to_json
end