Module: TwitterFriendly::REST::Timelines

Included in:
API
Defined in:
lib/twitter_friendly/rest/timelines.rb

Constant Summary collapse

MAX_TWEETS_PER_REQUEST =
200

Instance Method Summary collapse

Instance Method Details

#home_timeline(options = {}) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/twitter_friendly/rest/timelines.rb', line 7

def home_timeline(options = {})
  options = {include_rts: true, count: MAX_TWEETS_PER_REQUEST}.merge(options)
  if options[:count] <= MAX_TWEETS_PER_REQUEST
    @twitter.home_timeline(options)&.map(&:attrs)
  else
    fetch_tweets_with_max_id(__method__, MAX_TWEETS_PER_REQUEST, options)
  end
end

#mentions_timeline(options = {}) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/twitter_friendly/rest/timelines.rb', line 26

def mentions_timeline(options = {})
  options = {include_rts: true, count: MAX_TWEETS_PER_REQUEST}.merge(options)
  if options[:count] <= MAX_TWEETS_PER_REQUEST
    @twitter.mentions_timeline(options)&.map(&:attrs)
  else
    fetch_tweets_with_max_id(__method__, MAX_TWEETS_PER_REQUEST, options)
  end
end

#user_timeline(*args) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/twitter_friendly/rest/timelines.rb', line 16

def user_timeline(*args)
  options = {include_rts: true, count: MAX_TWEETS_PER_REQUEST}.merge(args.extract_options!)
  args << options
  if options[:count] <= MAX_TWEETS_PER_REQUEST
    @twitter.user_timeline(*args)&.map(&:attrs)
  else
    fetch_tweets_with_max_id(__method__, MAX_TWEETS_PER_REQUEST, *args)
  end
end