Class: MarkovTwitter::TweetReader
- Inherits:
-
Object
- Object
- MarkovTwitter::TweetReader
- Defined in:
- lib/markov_twitter/tweet_reader.rb
Overview
Fetches the latest tweets.
Instance Attribute Summary collapse
- #client ⇒ Twitter::REST::Client readonly
Instance Method Summary collapse
-
#get_tweets(username:) ⇒ Array<Hash>
-
the hashes will have :text and :id keys.
-
-
#initialize(client:) ⇒ TweetReader
constructor
A new instance of TweetReader.
Constructor Details
#initialize(client:) ⇒ TweetReader
Returns a new instance of TweetReader.
8 9 10 |
# File 'lib/markov_twitter/tweet_reader.rb', line 8 def initialize(client:) @client = client end |
Instance Attribute Details
#client ⇒ Twitter::REST::Client (readonly)
5 6 7 |
# File 'lib/markov_twitter/tweet_reader.rb', line 5 def client @client end |
Instance Method Details
#get_tweets(username:) ⇒ Array<Hash>
Returns - the hashes will have :text and :id keys.
15 16 17 18 |
# File 'lib/markov_twitter/tweet_reader.rb', line 15 def get_tweets(username:) user = client.user(username) client.user_timeline(user) end |