Class: Yt::Models::ResumableSession
- Defined in:
- lib/yt/models/resumable_session.rb
Overview
Provides methods to upload videos with the resumable upload protocol.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ResumableSession
constructor
Sets up a resumable session using the URI returned by YouTube.
-
#upload_video(file) ⇒ Yt::Models::Video
Uploads a video using the current resumable session.
Methods included from Associations::HasReports
Methods included from Associations::HasViewerPercentages
Methods included from Associations::HasOne
Methods included from Associations::HasMany
Methods included from Associations::HasAuthentication
Constructor Details
#initialize(options = {}) ⇒ ResumableSession
Sets up a resumable session using the URI returned by YouTube
10 11 12 13 14 |
# File 'lib/yt/models/resumable_session.rb', line 10 def initialize( = {}) @uri = URI.parse [:url] @auth = [:auth] @headers = [:headers] end |
Instance Method Details
#upload_video(file) ⇒ Yt::Models::Video
Uploads a video using the current resumable session
20 21 22 23 24 |
# File 'lib/yt/models/resumable_session.rb', line 20 def upload_video(file) do_update(body: file) do |data| Yt::Video.new id: data['id'], snippet: data['snippet'], status: data['privacyStatus'], auth: @auth end end |