Class: BadPigeon::HomeTimeline
- Inherits:
-
Object
- Object
- BadPigeon::HomeTimeline
- Includes:
- Assertions
- Defined in:
- lib/bad_pigeon/timelines/home_timeline.rb
Overview
Represents a timeline response for user’s “For You” or “Following” timeline.
A timeline includes one or more “instructions” (TimelineInstruction), and usually in particular a “TimelineAddEntries” instruction which provides one or more entries containing tweets.
Constant Summary collapse
- EXPECTED_INSTRUCTIONS =
[TimelineInstruction::Type::ADD_ENTRIES]
Instance Method Summary collapse
-
#initialize(json) ⇒ HomeTimeline
constructor
A new instance of HomeTimeline.
- #instructions ⇒ Object
Methods included from Assertions
Constructor Details
#initialize(json) ⇒ HomeTimeline
Returns a new instance of HomeTimeline.
16 17 18 |
# File 'lib/bad_pigeon/timelines/home_timeline.rb', line 16 def initialize(json) @json = json end |
Instance Method Details
#instructions ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/bad_pigeon/timelines/home_timeline.rb', line 20 def instructions @instructions ||= begin list = @json['data']['home']['home_timeline_urt']['instructions'] assert { list.all? { |i| EXPECTED_INSTRUCTIONS.include?(i['type']) }} list.map { |j| TimelineInstruction.new(j, self.class) } end end |