Class: Vimeo::Advanced::SimpleUpload::Task
- Inherits:
-
Object
- Object
- Vimeo::Advanced::SimpleUpload::Task
- Defined in:
- lib/vimeo/advanced/simple_upload/task.rb
Constant Summary collapse
- CHUNK_SIZE =
2 megabytes
2 * 1024 * 1024
Instance Attribute Summary collapse
-
#chunks ⇒ Object
readonly
Returns the value of attribute chunks.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#io ⇒ Object
readonly
Returns the value of attribute io.
-
#oauth_consumer ⇒ Object
readonly
Returns the value of attribute oauth_consumer.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#video_id ⇒ Object
readonly
Returns the value of attribute video_id.
-
#vimeo ⇒ Object
readonly
Returns the value of attribute vimeo.
Instance Method Summary collapse
-
#execute ⇒ Object
Uploads the file to Vimeo and returns the
video_id
on success. -
#initialize(vimeo, oauth_consumer, io, size, filename) ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize(vimeo, oauth_consumer, io, size, filename) ⇒ Task
Returns a new instance of Task.
12 13 14 15 16 |
# File 'lib/vimeo/advanced/simple_upload/task.rb', line 12 def initialize(vimeo, oauth_consumer, io, size, filename) @vimeo, @oauth_consumer = vimeo, oauth_consumer @io, @size, @filename = io, size, filename @chunks = [] end |
Instance Attribute Details
#chunks ⇒ Object (readonly)
Returns the value of attribute chunks.
9 10 11 |
# File 'lib/vimeo/advanced/simple_upload/task.rb', line 9 def chunks @chunks end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
9 10 11 |
# File 'lib/vimeo/advanced/simple_upload/task.rb', line 9 def endpoint @endpoint end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
8 9 10 |
# File 'lib/vimeo/advanced/simple_upload/task.rb', line 8 def filename @filename end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/vimeo/advanced/simple_upload/task.rb', line 10 def id @id end |
#io ⇒ Object (readonly)
Returns the value of attribute io.
8 9 10 |
# File 'lib/vimeo/advanced/simple_upload/task.rb', line 8 def io @io end |
#oauth_consumer ⇒ Object (readonly)
Returns the value of attribute oauth_consumer.
7 8 9 |
# File 'lib/vimeo/advanced/simple_upload/task.rb', line 7 def oauth_consumer @oauth_consumer end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
8 9 10 |
# File 'lib/vimeo/advanced/simple_upload/task.rb', line 8 def size @size end |
#video_id ⇒ Object (readonly)
Returns the value of attribute video_id.
10 11 12 |
# File 'lib/vimeo/advanced/simple_upload/task.rb', line 10 def video_id @video_id end |
#vimeo ⇒ Object (readonly)
Returns the value of attribute vimeo.
7 8 9 |
# File 'lib/vimeo/advanced/simple_upload/task.rb', line 7 def vimeo @vimeo end |
Instance Method Details
#execute ⇒ Object
Uploads the file to Vimeo and returns the video_id
on success.
19 20 21 22 23 24 25 26 27 |
# File 'lib/vimeo/advanced/simple_upload/task.rb', line 19 def execute check_quota upload raise UploadError.new, "Validation of chunks failed." unless valid? complete return video_id end |