Module: Totter::Client::Timelines
- Included in:
- Totter::Client
- Defined in:
- lib/totter/client/timelines.rb
Overview
Client methods for working with timelines.
Constant Summary collapse
- DEFAULT_TIMELINE_OPTIONS =
Default options sent with every timeline request unless otherwise specified.
{ :limit => 20 }
Instance Method Summary collapse
-
#flagged_timeline(options = DEFAULT_TIMELINE_OPTIONS) ⇒ Array
Get recent decisions from the flagged-for-review timeline.
-
#friends_timeline(user_id, options = DEFAULT_TIMELINE_OPTIONS) ⇒ Array
Get the friends timeline (also known as “feed” or “home”) for a given user.
-
#global_timeline(options = DEFAULT_TIMELINE_OPTIONS) ⇒ Array
Get recent decisions from the global timeline.
-
#hashtag_timeline(hashtag, options = DEFAULT_TIMELINE_OPTIONS) ⇒ Array
Get recent decisions from a hashtag timeline.
-
#random_timeline_decision(options = {}) ⇒ Object
Get random decision from current timeline.
-
#search_timeline(query, options = DEFAULT_TIMELINE_OPTIONS) ⇒ Array
Search for published items.
-
#sticker_timeline(sticker, options = DEFAULT_TIMELINE_OPTIONS) ⇒ Array
Get recent decisions from a sticker timeline.
-
#user_timeline(user_id, options = DEFAULT_TIMELINE_OPTIONS) ⇒ Array
Get recent decisions from a given user.
Instance Method Details
#flagged_timeline(options = DEFAULT_TIMELINE_OPTIONS) ⇒ Array
Get recent decisions from the flagged-for-review timeline
86 87 88 |
# File 'lib/totter/client/timelines.rb', line 86 def flagged_timeline( = DEFAULT_TIMELINE_OPTIONS) format_timeline_result get('timelines/flagged', ) end |
#friends_timeline(user_id, options = DEFAULT_TIMELINE_OPTIONS) ⇒ Array
Get the friends timeline (also known as “feed” or “home”) for a given user. Note, you must use the user ID that belongs to the access token as the ‘user_id` parameter.
Requires authenticatied client.
117 118 119 |
# File 'lib/totter/client/timelines.rb', line 117 def friends_timeline(user_id, = DEFAULT_TIMELINE_OPTIONS) format_timeline_result get("users/#{user_id}/timelines/friends", ) end |
#global_timeline(options = DEFAULT_TIMELINE_OPTIONS) ⇒ Array
Get recent decisions from the global timeline.
19 20 21 |
# File 'lib/totter/client/timelines.rb', line 19 def global_timeline( = DEFAULT_TIMELINE_OPTIONS) format_timeline_result get('timelines/global', ) end |
#hashtag_timeline(hashtag, options = DEFAULT_TIMELINE_OPTIONS) ⇒ Array
Get recent decisions from a hashtag timeline
33 34 35 |
# File 'lib/totter/client/timelines.rb', line 33 def hashtag_timeline(hashtag, = DEFAULT_TIMELINE_OPTIONS) format_timeline_result get('timelines/global', .merge({:hashtag => hashtag})) end |
#random_timeline_decision(options = {}) ⇒ Object
Get random decision from current timeline
59 60 61 |
# File 'lib/totter/client/timelines.rb', line 59 def random_timeline_decision( = {}) get('timelines/global/random', .merge({:limit => 1})).body end |
#search_timeline(query, options = DEFAULT_TIMELINE_OPTIONS) ⇒ Array
Search for published items
73 74 75 |
# File 'lib/totter/client/timelines.rb', line 73 def search_timeline(query, = DEFAULT_TIMELINE_OPTIONS) format_timeline_result get('timelines/search', .merge({:query => query})) end |
#sticker_timeline(sticker, options = DEFAULT_TIMELINE_OPTIONS) ⇒ Array
Get recent decisions from a sticker timeline
47 48 49 |
# File 'lib/totter/client/timelines.rb', line 47 def sticker_timeline(sticker, = DEFAULT_TIMELINE_OPTIONS) format_timeline_result get('timelines/global', .merge({:sticker => sticker})) end |
#user_timeline(user_id, options = DEFAULT_TIMELINE_OPTIONS) ⇒ Array
Get recent decisions from a given user.
100 101 102 |
# File 'lib/totter/client/timelines.rb', line 100 def user_timeline(user_id, = DEFAULT_TIMELINE_OPTIONS) format_timeline_result get("users/#{user_id}/timelines/user", ) end |