Class: Twitter::DirectMessageEvent
- Defined in:
- lib/twitter/direct_message_event.rb
Instance Attribute Summary collapse
-
#created_timestamp ⇒ Object
readonly
Returns the value of attribute created_timestamp.
Attributes inherited from Identity
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(attrs) ⇒ DirectMessageEvent
constructor
A new instance of DirectMessageEvent.
Methods included from Entities
#entities?, #hashtags, #hashtags?, #media, #media?, #symbols, #symbols?, #uris, #uris?, #user_mentions, #user_mentions?
Methods included from Creatable
Methods inherited from Base
#[], attr_reader, define_attribute_method, define_predicate_method, define_uri_method, display_uri_attr_reader, object_attr_reader, predicate_attr_reader, uri_attr_reader
Methods included from Utils
Constructor Details
#initialize(attrs) ⇒ DirectMessageEvent
Returns a new instance of DirectMessageEvent.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/twitter/direct_message_event.rb', line 14 def initialize(attrs) attrs = read_from_response(attrs) text = attrs.dig(:message_create, :message_data, :text) urls = attrs.dig(:message_create, :message_data, :entities, :urls) text.gsub!(urls[0][:url], urls[0][:expanded_url]) if urls.any? attrs[:direct_message] = (attrs, text) super end |
Instance Attribute Details
#created_timestamp ⇒ Object (readonly)
Returns the value of attribute created_timestamp.
10 11 12 |
# File 'lib/twitter/direct_message_event.rb', line 10 def @created_timestamp end |