Class: Twitter::DirectMessages::WelcomeMessageWrapper
- Defined in:
- lib/twitter/direct_messages/welcome_message_wrapper.rb
Overview
Wraps a Twitter welcome message response
Instance Attribute Summary collapse
-
#created_timestamp ⇒ String
readonly
The timestamp when the message was created.
Attributes inherited from Identity
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(attrs) ⇒ Twitter::DirectMessages::WelcomeMessageWrapper
constructor
Initializes a new WelcomeMessageWrapper.
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) ⇒ Twitter::DirectMessages::WelcomeMessageWrapper
Initializes a new WelcomeMessageWrapper
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/twitter/direct_messages/welcome_message_wrapper.rb', line 25 def initialize(attrs) attrs = read_from_response(attrs) = attrs.fetch(:message_data) text = .fetch(:text) urls = .fetch(:entities).fetch(:urls) text = text.gsub(urls.fetch(0).fetch(:url), urls.fetch(0).fetch(:expanded_url)) if urls.any? attrs[:welcome_message] = (attrs, text, ) super end |
Instance Attribute Details
#created_timestamp ⇒ String (readonly)
The timestamp when the message was created
14 15 16 |
# File 'lib/twitter/direct_messages/welcome_message_wrapper.rb', line 14 def @created_timestamp end |