Class: Appydave::Tools::YouTubeManager::UpdateVideo

Inherits:
YouTubeBase
  • Object
show all
Defined in:
lib/appydave/tools/youtube_manager/update_video.rb

Overview

Update YouTube video details

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(video_details) ⇒ UpdateVideo

Returns a new instance of UpdateVideo.



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

def initialize(video_details)
  super()
  @video_details = video_details
end

Instance Attribute Details

#snippetObject (readonly)

Returns the value of attribute snippet.



9
10
11
# File 'lib/appydave/tools/youtube_manager/update_video.rb', line 9

def snippet
  @snippet
end

#video_detailsObject (readonly)

Returns the value of attribute video_details.



8
9
10
# File 'lib/appydave/tools/youtube_manager/update_video.rb', line 8

def video_details
  @video_details
end

Instance Method Details

#category_id(category_id) ⇒ Object



34
35
36
37
38
# File 'lib/appydave/tools/youtube_manager/update_video.rb', line 34

def category_id(category_id)
  video_details.category_id = category_id

  self
end

#description(description) ⇒ Object



22
23
24
25
26
# File 'lib/appydave/tools/youtube_manager/update_video.rb', line 22

def description(description)
  video_details.description = description

  self
end

#saveObject



40
41
42
43
44
45
46
47
48
49
# File 'lib/appydave/tools/youtube_manager/update_video.rb', line 40

def save
  snippet = video_details.map_video_snippet

  video = Google::Apis::YoutubeV3::Video.new(
    id: video_details.id,
    snippet: snippet
  )

  @service.update_video('snippet', video)
end

#tags(tags) ⇒ Object



28
29
30
31
32
# File 'lib/appydave/tools/youtube_manager/update_video.rb', line 28

def tags(tags)
  video_details.tags = tags

  self
end

#title(title) ⇒ Object



16
17
18
19
20
# File 'lib/appydave/tools/youtube_manager/update_video.rb', line 16

def title(title)
  video_details.title = title

  self
end