Class: StashNotifier::BuildResult

Inherits:
Object
  • Object
show all
Defined in:
lib/stash_notifier/build_result.rb

Constant Summary collapse

VALID_BUILD_STATES =
%w{ INPROGRESS SUCCESSFUL FAILED }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ BuildResult

Returns a new instance of BuildResult.



24
25
26
27
28
29
30
# 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

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



19
20
21
# File 'lib/stash_notifier/build_result.rb', line 19

def description
  @description
end

#keyObject

Returns the value of attribute key.



19
20
21
# File 'lib/stash_notifier/build_result.rb', line 19

def key
  @key
end

#nameObject

Returns the value of attribute name.



19
20
21
# File 'lib/stash_notifier/build_result.rb', line 19

def name
  @name
end

#stateObject

Returns the value of attribute state.



20
21
22
# File 'lib/stash_notifier/build_result.rb', line 20

def state
  @state
end

#urlObject

Returns the value of attribute url.



19
20
21
# File 'lib/stash_notifier/build_result.rb', line 19

def url
  @url
end

Instance Method Details

#to_jsonObject



41
42
43
44
45
46
47
48
49
50
# 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