Class: BadPigeon::TimelineTweet

Inherits:
Object
  • Object
show all
Includes:
Assertions
Defined in:
lib/bad_pigeon/elements/timeline_tweet.rb

Overview

Represents a single tweet in a timeline (may possibly include no data in some cases).

Use the #tweet method to get an instance of Tweet, which is the final tweet model from which you can extract specific fields or a properly formatted JSON representation.

Instance Method Summary collapse

Methods included from Assertions

extended, included

Constructor Details

#initialize(json) ⇒ TimelineTweet

Returns a new instance of TimelineTweet.



14
15
16
# File 'lib/bad_pigeon/elements/timeline_tweet.rb', line 14

def initialize(json)
  @json = json
end

Instance Method Details

#tweetObject



18
19
20
# File 'lib/bad_pigeon/elements/timeline_tweet.rb', line 18

def tweet
  @json['tweet_results']['result'] && Tweet.from_result(@json['tweet_results']['result'])
end