Class: RocketChat::Realtime::Messages::Changed

Inherits:
RocketChat::Realtime::Message show all
Defined in:
lib/rocket_chat/realtime/messages/changed.rb

Overview

The changed message

The DDP subscription changed message

Since:

  • 0.1.0

Instance Attribute Summary collapse

Attributes inherited from RocketChat::Realtime::Message

#id, #type

Instance Method Summary collapse

Methods inherited from RocketChat::Realtime::Message

#to_json

Constructor Details

#initialize(id, message) ⇒ Changed

Returns a new instance of Changed.

Parameters:

  • args (Array)

    the parameters for method

Since:

  • 0.1.0



18
19
20
21
22
23
24
# File 'lib/rocket_chat/realtime/messages/changed.rb', line 18

def initialize(id, message)
  super('changed', id)

  @fields = message.fetch('fields', nil)
  @cleared = message.fetch('cleared', nil)
  @collection = message.fetch('collection', nil)
end

Instance Attribute Details

#clearedObject (readonly)

Since:

  • 0.1.0



15
16
17
# File 'lib/rocket_chat/realtime/messages/changed.rb', line 15

def cleared
  @cleared
end

#collectionObject (readonly)

Since:

  • 0.1.0



15
16
17
# File 'lib/rocket_chat/realtime/messages/changed.rb', line 15

def collection
  @collection
end

#fieldsObject (readonly)

Since:

  • 0.1.0



15
16
17
# File 'lib/rocket_chat/realtime/messages/changed.rb', line 15

def fields
  @fields
end

Instance Method Details

#[](key) ⇒ Object

:nodoc:

Since:

  • 0.1.0



38
39
40
# File 'lib/rocket_chat/realtime/messages/changed.rb', line 38

def [](key)
  fields.fetch(key.to_s, nil)
end

#bodyObject

See Also:

Since:

  • 0.1.0



29
30
31
32
33
34
35
# File 'lib/rocket_chat/realtime/messages/changed.rb', line 29

def body
  {
    fields: fields,
    cleared: cleared,
    collection: collection
  }
end