Class: Gnip::SystemMessage

Inherits:
Message
  • Object
show all
Defined in:
lib/gnip_api/gnip/system_message.rb

Constant Summary

Constants inherited from Message

Message::SYSTEM_MESSAGE_TYPES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Message

#activity?, build, #error?, #generate_json, #info?, #system_message?, #warn?

Constructor Details

#initialize(params) ⇒ SystemMessage

Returns a new instance of SystemMessage.


5
6
7
8
9
# File 'lib/gnip_api/gnip/system_message.rb', line 5

def initialize params
  @message_type = params.keys.first
  @message = params['message']
  @sent = params['sent']
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.


3
4
5
# File 'lib/gnip_api/gnip/system_message.rb', line 3

def message
  @message
end

#message_typeObject (readonly)

Returns the value of attribute message_type.


3
4
5
# File 'lib/gnip_api/gnip/system_message.rb', line 3

def message_type
  @message_type
end

#sentObject (readonly)

Returns the value of attribute sent.


3
4
5
# File 'lib/gnip_api/gnip/system_message.rb', line 3

def sent
  @sent
end

Instance Method Details

#log_methodObject


18
19
20
# File 'lib/gnip_api/gnip/system_message.rb', line 18

def log_method
  @message_type.to_sym
end

#original_attributesObject


11
12
13
14
15
16
# File 'lib/gnip_api/gnip/system_message.rb', line 11

def original_attributes
  {
    @message_type => @message,
    :sent => @sent
  }
end

#to_jsonObject


26
27
28
# File 'lib/gnip_api/gnip/system_message.rb', line 26

def to_json
  parse_json(original_attributes)
end