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.
- #update(params = {}) ⇒ Object
-
#upload_thumbnail(file) ⇒ Object
Uploads a thumbnail 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
#update(params = {}) ⇒ Object
16 17 18 |
# File 'lib/yt/models/resumable_session.rb', line 16 def update(params = {}) do_update(params) {|data| yield data} end |
#upload_thumbnail(file) ⇒ Object
Uploads a thumbnail using the current resumable session
25 26 27 |
# File 'lib/yt/models/resumable_session.rb', line 25 def upload_thumbnail(file) do_update(body: file) {|data| data['items'].first} end |