Class: Appydave::Tools::YouTubeManager::Models::YouTubeDetails
- Inherits:
-
Object
- Object
- Appydave::Tools::YouTubeManager::Models::YouTubeDetails
- Includes:
- ActiveModel::Attributes, ActiveModel::Model
- Defined in:
- lib/appydave/tools/youtube_manager/models/youtube_details.rb
Overview
Model to store YouTube video details
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ YouTubeDetails
constructor
A new instance of YouTubeDetails.
- #map_video_snippet ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ YouTubeDetails
Returns a new instance of YouTubeDetails.
45 46 47 48 |
# File 'lib/appydave/tools/youtube_manager/models/youtube_details.rb', line 45 def initialize(attributes = {}) super self. = attributes[:captions].map { || Captions.new() } if attributes[:captions] end |
Instance Method Details
#map_video_snippet ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/appydave/tools/youtube_manager/models/youtube_details.rb', line 50 def map_video_snippet { title: title, description: description, category_id: category_id, tags: || [], thumbnails: thumbnails } end |
#to_h ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/appydave/tools/youtube_manager/models/youtube_details.rb', line 60 def to_h { id: id, title: title, description: description, published_at: published_at, channel_id: channel_id, channel_title: channel_title, category_id: category_id, category_title: category_title, default_audio_language: default_audio_language, default_language: default_language, live_broadcast_content: live_broadcast_content, tags: , thumbnails: thumbnails, view_count: view_count, like_count: like_count, dislike_count: dislike_count, comment_count: comment_count, privacy_status: privacy_status, embeddable: , license: license, recording_location: recording_location, recording_date: recording_date, duration: duration, definition: definition, caption: , licensed_content: licensed_content } # captions: captions.map(&:to_h) end |