Class: LatestTweets::TwitterTimeline
- Inherits:
-
Object
- Object
- LatestTweets::TwitterTimeline
- Defined in:
- lib/latest_tweets/twitter_timeline.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options) ⇒ TwitterTimeline
constructor
A new instance of TwitterTimeline.
- #tweets ⇒ Object
Constructor Details
#initialize(options) ⇒ TwitterTimeline
Returns a new instance of TwitterTimeline.
5 6 7 8 9 10 11 |
# File 'lib/latest_tweets/twitter_timeline.rb', line 5 def initialize() @client = config_twitter @options = .merge() if (@options[:account] && @options[:query]) || (!@options[:account] && !@options[:query]) raise "You must supply :account OR :query" end end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
3 4 5 |
# File 'lib/latest_tweets/twitter_timeline.rb', line 3 def client @client end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/latest_tweets/twitter_timeline.rb', line 3 def @options end |
Instance Method Details
#tweets ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/latest_tweets/twitter_timeline.rb', line 13 def tweets if [:account] client.user_timeline([:account], count: [:count]) elsif [:query] client.search([:query], count: [:count]).to_a end end |