Class: Appydave::Tools::YouTubeManager::GetVideo

Inherits:
YouTubeBase
  • Object
show all
Includes:
KLog::Logging
Defined in:
lib/appydave/tools/youtube_manager/get_video.rb

Overview

Manage YouTube video details

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from YouTubeBase

#initialize

Constructor Details

This class inherits a constructor from Appydave::Tools::YouTubeManager::YouTubeBase

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



11
12
13
# File 'lib/appydave/tools/youtube_manager/get_video.rb', line 11

def data
  @data
end

#video_idObject (readonly)

Returns the value of attribute video_id.



10
11
12
# File 'lib/appydave/tools/youtube_manager/get_video.rb', line 10

def video_id
  @video_id
end

Instance Method Details

#get(video_id) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/appydave/tools/youtube_manager/get_video.rb', line 13

def get(video_id)
  @data = nil
  @video_id = video_id
  response = @service.list_videos('snippet,contentDetails,status,statistics', id: video_id)
  video = response.items.first

  return unless video

  build_data(video)
end

#video?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/appydave/tools/youtube_manager/get_video.rb', line 24

def video?
  !data.nil?
end