Class: PipeDream::Result::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/pipe_dream/results/base.rb

Direct Known Subclasses

Channel, Playlist, Video

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Base

Returns a new instance of Base.



4
5
6
# File 'lib/pipe_dream/results/base.rb', line 4

def initialize(data)
  @data = data
end

Instance Method Details

#channel_idObject



12
13
14
# File 'lib/pipe_dream/results/base.rb', line 12

def channel_id
  @channel_id ||= snippet.fetch('channelId')
end

#channel_titleObject



30
31
32
# File 'lib/pipe_dream/results/base.rb', line 30

def channel_title
  @channel_title ||= snippet.fetch('channelTitle')
end

#descriptionObject



20
21
22
# File 'lib/pipe_dream/results/base.rb', line 20

def description
  @description ||= snippet.fetch('description')
end

#live_broadcast_contentObject



34
35
36
# File 'lib/pipe_dream/results/base.rb', line 34

def live_broadcast_content
  @live_broadcast_content ||= snippet.fetch('liveBroadcastContent')
end

#published_atObject Also known as: created_at



8
9
10
# File 'lib/pipe_dream/results/base.rb', line 8

def published_at
  @published_at ||= snippet.fetch('publishedAt')
end

#thumbnail_url(size = :small) ⇒ Object

TODO: Add thumbnail dimension info?



25
26
27
28
# File 'lib/pipe_dream/results/base.rb', line 25

def thumbnail_url(size = :small)
  @thumbnail_url ||=
    snippet.dig('thumbnails', size_mappings.fetch(size, 'default'), 'url')
end

#titleObject



16
17
18
# File 'lib/pipe_dream/results/base.rb', line 16

def title
  @title ||= snippet.fetch('title')
end