Class: Siding::Staleness::Events::Event

Inherits:
Struct
  • Object
show all
Defined in:
lib/siding/staleness.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#atObject

Returns the value of attribute at

Returns:

  • (Object)

    the current value of at



114
115
116
# File 'lib/siding/staleness.rb', line 114

def at
  @at
end

#developer_waitObject

Returns the value of attribute developer_wait

Returns:

  • (Object)

    the current value of developer_wait



114
115
116
# File 'lib/siding/staleness.rb', line 114

def developer_wait
  @developer_wait
end

#reasonObject

Returns the value of attribute reason

Returns:

  • (Object)

    the current value of reason



114
115
116
# File 'lib/siding/staleness.rb', line 114

def reason
  @reason
end

#resolutionObject

Returns the value of attribute resolution

Returns:

  • (Object)

    the current value of resolution



114
115
116
# File 'lib/siding/staleness.rb', line 114

def resolution
  @resolution
end

#trigger_pathsObject

Returns the value of attribute trigger_paths

Returns:

  • (Object)

    the current value of trigger_paths



114
115
116
# File 'lib/siding/staleness.rb', line 114

def trigger_paths
  @trigger_paths
end

Class Method Details

.from_h(hash) ⇒ Object



126
127
128
129
130
131
132
# File 'lib/siding/staleness.rb', line 126

def self.from_h(hash)
  new(at: Time.iso8601(hash["at"]), reason: hash["reason"],
      trigger_paths: Array(hash["trigger_paths"]), resolution: hash["resolution"],
      developer_wait: hash["developer_wait"])
rescue ArgumentError, TypeError
  nil
end

Instance Method Details

#to_hObject



116
117
118
119
120
121
122
123
124
# File 'lib/siding/staleness.rb', line 116

def to_h
  {
    "at" => at.iso8601(3),
    "reason" => reason.to_s,
    "trigger_paths" => trigger_paths,
    "resolution" => resolution,
    "developer_wait" => developer_wait
  }
end