Class: OpenHAB::Core::Events::AbstractEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/openhab/core/events/abstract_event.rb

Overview

Add attachments event data.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attachmentObject

Returns:

  • (Object)


11
12
13
# File 'lib/openhab/core/events/abstract_event.rb', line 11

def attachment
  @attachment
end

#inputsHash

Returns:

  • (Hash)


14
15
16
# File 'lib/openhab/core/events/abstract_event.rb', line 14

def inputs
  @inputs
end

Instance Method Details

#payloadHash?

Returns the event payload as a Hash.

Returns:

  • (Hash, nil)

    The payload object parsed by JSON. The keys are symbolized. ‘nil` when the payload is empty.



25
26
27
28
# File 'lib/openhab/core/events/abstract_event.rb', line 25

def payload
  require "json"
  @payload ||= JSON.parse(get_payload, symbolize_names: true) unless get_payload.empty?
end