vzaar 0.2.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +24 -0
  3. data/.rspec +2 -0
  4. data/.ruby-version +1 -0
  5. data/.rvmrc +1 -0
  6. data/.travis.yml +3 -0
  7. data/Gemfile +19 -0
  8. data/Guardfile +9 -0
  9. data/LICENSE +20 -0
  10. data/LICENSE.txt +22 -0
  11. data/README.md +112 -0
  12. data/Rakefile +8 -0
  13. data/lib/vzaar.rb +61 -53
  14. data/lib/vzaar/api.rb +63 -0
  15. data/lib/vzaar/connection.rb +76 -0
  16. data/lib/vzaar/ext/oauth.rb +18 -0
  17. data/lib/vzaar/request/account_type.rb +12 -0
  18. data/lib/vzaar/request/base.rb +81 -0
  19. data/lib/vzaar/request/delete_video.rb +9 -0
  20. data/lib/vzaar/request/edit_video.rb +21 -0
  21. data/lib/vzaar/request/link_upload.rb +33 -0
  22. data/lib/vzaar/request/multipart.rb +42 -0
  23. data/lib/vzaar/request/process_video.rb +81 -0
  24. data/lib/vzaar/request/signature.rb +26 -0
  25. data/lib/vzaar/request/upload_status.rb +12 -0
  26. data/lib/vzaar/request/upload_thumbnail.rb +14 -0
  27. data/lib/vzaar/request/url.rb +24 -0
  28. data/lib/vzaar/request/user_details.rb +12 -0
  29. data/lib/vzaar/request/video.rb +12 -0
  30. data/lib/vzaar/request/video_details.rb +7 -0
  31. data/lib/vzaar/request/video_list.rb +16 -0
  32. data/lib/vzaar/request/who_am_i.rb +13 -0
  33. data/lib/vzaar/resources/account_type.rb +16 -0
  34. data/lib/vzaar/resources/base.rb +87 -0
  35. data/lib/vzaar/resources/link_upload.rb +8 -0
  36. data/lib/vzaar/resources/processed_video.rb +8 -0
  37. data/lib/vzaar/resources/signature.rb +21 -0
  38. data/lib/vzaar/resources/upload_thumbnail.rb +8 -0
  39. data/lib/vzaar/resources/user.rb +26 -0
  40. data/lib/vzaar/resources/video.rb +39 -0
  41. data/lib/vzaar/resources/video_collection.rb +16 -0
  42. data/lib/vzaar/resources/video_collection_item.rb +25 -0
  43. data/lib/vzaar/resources/video_details.rb +13 -0
  44. data/lib/vzaar/resources/video_status.rb +12 -0
  45. data/lib/vzaar/resources/who_am_i.rb +8 -0
  46. data/lib/vzaar/response/base.rb +40 -0
  47. data/lib/vzaar/signature_extractor.rb +41 -0
  48. data/lib/vzaar/uploader.rb +43 -0
  49. data/lib/vzaar/uploaders/s3.rb +32 -0
  50. data/lib/vzaar/version.rb +3 -0
  51. data/spec/fixtures/vcr_cassettes/account_type-fail.yml +44 -0
  52. data/spec/fixtures/vcr_cassettes/account_type-success.yml +49 -0
  53. data/spec/fixtures/vcr_cassettes/delete_video-fail.yml +47 -0
  54. data/spec/fixtures/vcr_cassettes/delete_video-not-found.yml +125 -0
  55. data/spec/fixtures/vcr_cassettes/delete_video-retry-success.yml +125 -0
  56. data/spec/fixtures/vcr_cassettes/delete_video-success.yml +59 -0
  57. data/spec/fixtures/vcr_cassettes/edit_video-fail.yml +53 -0
  58. data/spec/fixtures/vcr_cassettes/edit_video-not-found.yml +131 -0
  59. data/spec/fixtures/vcr_cassettes/edit_video-success.yml +68 -0
  60. data/spec/fixtures/vcr_cassettes/process_video-default.yml +55 -0
  61. data/spec/fixtures/vcr_cassettes/signature-default.yml +54 -0
  62. data/spec/fixtures/vcr_cassettes/signature-with-options.yml +55 -0
  63. data/spec/fixtures/vcr_cassettes/upload_video-success.yml +5926 -0
  64. data/spec/fixtures/vcr_cassettes/user_details-authenticated-fail.yml +122 -0
  65. data/spec/fixtures/vcr_cassettes/user_details-authenticated-success.yml +53 -0
  66. data/spec/fixtures/vcr_cassettes/user_details-public-fail.yml +121 -0
  67. data/spec/fixtures/vcr_cassettes/user_details-public-success.yml +52 -0
  68. data/spec/fixtures/vcr_cassettes/video_details-pub-authenticated-fail.yml +45 -0
  69. data/spec/fixtures/vcr_cassettes/video_details-pub-authenticated-success.yml +60 -0
  70. data/spec/fixtures/vcr_cassettes/video_details-pub-public-fail.yml +44 -0
  71. data/spec/fixtures/vcr_cassettes/video_details-pub-public-success.yml +59 -0
  72. data/spec/fixtures/vcr_cassettes/video_details-pvt-authenticated-fail.yml +45 -0
  73. data/spec/fixtures/vcr_cassettes/video_details-pvt-authenticated-success.yml +63 -0
  74. data/spec/fixtures/vcr_cassettes/video_details-pvt-public-fail.yml +44 -0
  75. data/spec/fixtures/vcr_cassettes/video_details-pvt-public-success.yml +44 -0
  76. data/spec/fixtures/vcr_cassettes/video_list-authenticated-success.yml +63 -0
  77. data/spec/fixtures/vcr_cassettes/video_list-pub-success.yml +53 -0
  78. data/spec/fixtures/vcr_cassettes/video_list-pvt-success.yml +65 -0
  79. data/spec/fixtures/vcr_cassettes/whoami-fail.yml +45 -0
  80. data/spec/fixtures/vcr_cassettes/whoami-success.yml +50 -0
  81. data/spec/spec_helper.rb +36 -0
  82. data/spec/support/cfx.jpeg +0 -0
  83. data/spec/support/cfx.png +0 -0
  84. data/spec/support/pic.jpg +0 -0
  85. data/spec/vzaar/api_xml_spec.rb +353 -0
  86. data/spec/vzaar/connection_spec.rb +26 -0
  87. data/spec/vzaar/request/base_spec.rb +66 -0
  88. data/spec/vzaar/request/url_spec.rb +25 -0
  89. data/spec/vzaar/resources/account_type_spec.rb +29 -0
  90. data/spec/vzaar/resources/signature_spec.rb +56 -0
  91. data/spec/vzaar/uploader_spec.rb +46 -0
  92. data/spec/vzaar_spec.rb +6 -0
  93. data/vzaar.gemspec +35 -0
  94. metadata +317 -95
  95. data/Changelog +0 -17
  96. data/README +0 -12
  97. data/demo.rb +0 -37
  98. data/lib/rails/controllers/vzaar_controller.rb +0 -37
  99. data/lib/rails/views/view_helpers.rb +0 -177
  100. data/lib/vzaar/account_type.rb +0 -31
  101. data/lib/vzaar/base.rb +0 -470
  102. data/lib/vzaar/errors.rb +0 -6
  103. data/lib/vzaar/signature.rb +0 -31
  104. data/lib/vzaar/user.rb +0 -28
  105. data/lib/vzaar/video.rb +0 -38
  106. data/lib/vzaar/video_details.rb +0 -72
  107. data/rails_generators/vzaar_uploader/USAGE +0 -1
  108. data/rails_generators/vzaar_uploader/templates/flash/swfupload.swf +0 -0
  109. data/rails_generators/vzaar_uploader/templates/flash/swfupload_fp9.swf +0 -0
  110. data/rails_generators/vzaar_uploader/templates/images/cancelbutton.gif +0 -0
  111. data/rails_generators/vzaar_uploader/templates/javascripts/fileprogress.js +0 -197
  112. data/rails_generators/vzaar_uploader/templates/javascripts/handlers.js +0 -259
  113. data/rails_generators/vzaar_uploader/templates/javascripts/json_parse.js +0 -345
  114. data/rails_generators/vzaar_uploader/templates/javascripts/swfupload.js +0 -1132
  115. data/rails_generators/vzaar_uploader/templates/javascripts/swfupload.queue.js +0 -98
  116. data/rails_generators/vzaar_uploader/templates/stylesheets/swfupload.css +0 -335
  117. data/rails_generators/vzaar_uploader/templates/views/uploader.html.erb +0 -15
  118. data/rails_generators/vzaar_uploader/vzaar_uploader_generator.rb +0 -52
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzdkYjI2M2RlM2VhMjIxNGNmMDVhMzM2MjQ5NDI3ZDg2NTU0ZjU4Ng==
5
+ data.tar.gz: !binary |-
6
+ NmZjYjI4OWI4OTQ3NWFjYmQ4YzM0ODMzZDA3OWYyNWIyODBiNGJlMg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MmU1MmQ0ZTkyNzNmZTY3Nzc3YTkyODNiZTFmNjI2MzIwZWU3MGE5Mjg0YWU5
10
+ MGVkZTE5Y2U0MmE0MDFiZWY1YmE5OTU5MzgxMTIzYTY4Y2U0OWEyMTM0MDFl
11
+ N2YyNjM5YzgzZDBiZmVhZDM3OThiYzQ5MjhiMjAzMWQ4ODQ2NWY=
12
+ data.tar.gz: !binary |-
13
+ OTcxMmU2M2E5Mjk0NTQyOGVlNmNlNTAwZjUzMzcwZDNiZDQ0MjVhM2M4OWRk
14
+ YTcwNjI5ZTQ4ZWI1YzcwZDc2ZTlmYmJiYzVlOTMxNjFlYjNlNzJkNzU1MDE4
15
+ ZDViMzgxNDEyYWMxN2RhNGRmNDRiMmFmODc0MDBmYzdlOTU2Y2U=
@@ -0,0 +1,24 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ load.rb
19
+ .irbrc
20
+ *~
21
+ *\.\#*
22
+ *\#
23
+ *.mp4
24
+ test.rb
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format Fuubar
@@ -0,0 +1 @@
1
+ 2.1.1
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use ruby-2.1.1@vzaar --create
@@ -0,0 +1,3 @@
1
+ rvm:
2
+ - 1.9.3
3
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source "https://rubygems.org"
2
+
3
+ # gem 'httpclient'
4
+ # gem 'nokogiri'
5
+ # gem 'oauth'
6
+
7
+ gemspec
8
+
9
+ gem 'rake'
10
+
11
+ group :development, :test do
12
+ gem 'pry'
13
+ gem 'fuubar'
14
+ gem 'growl'
15
+ gem 'guard-rspec'
16
+ gem 'rspec'
17
+ gem 'vcr'
18
+ gem 'webmock'
19
+ end
@@ -0,0 +1,9 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :rspec, all_after_pass: true, all_on_start: true do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/vzaar.rb$}) { "spec" }
7
+ watch(%r{^lib/vzaar/(.+)\.rb$}) { "spec" }
8
+ watch('spec/spec_helper.rb') { "spec" }
9
+ end
data/LICENSE CHANGED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Ed James
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Ed James
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,112 @@
1
+ # vzaar [![Build Status](https://secure.travis-ci.org/vzaar/vzaar-api-ruby.png)](http://travis-ci.org/vzaar/vzaar-api-ruby) [![Code Climate](https://codeclimate.com/github/vzaar/vzaar-api-ruby.png)](https://codeclimate.com/github/vzaar/vzaar-api-ruby)
2
+
3
+ A Ruby gem for the vzaar API.
4
+
5
+ Note: This version is a beta release.
6
+
7
+ ### Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'vzaar', :git => "git@github.com:vzaar/vzaar-api-ruby.git", :branch => 'master'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+
18
+ ### Usage
19
+
20
+ ```ruby
21
+ conn = Vzaar::Connection.new(:application_token => "API token", :login => "vzaar login")
22
+ api = Vzaar::Api.new(conn)
23
+ ```
24
+
25
+ If your login and API token are correct, you should be able to fetch your login by calling:
26
+ ```ruby
27
+ api.whoami
28
+ => "VZAAR LOGIN"
29
+ ```
30
+
31
+ ### Endpoints:
32
+
33
+ Fetching account's type details:
34
+ ```ruby
35
+ api.account_type(account_type_id, options)
36
+ ```
37
+
38
+ Fetching user's details:
39
+ ```ruby
40
+ api.user_details("user login", options)
41
+ ```
42
+
43
+ Getting details from public video:
44
+ ```ruby
45
+ api.video_details(video_id, options)
46
+ ```
47
+
48
+ Getting details from private video (authentication required):
49
+ ```ruby
50
+ api.video_details(video_id, authenticated: true)
51
+ ```
52
+
53
+ Fetching videos for a given user:
54
+ ```ruby
55
+ api.video_details("user login", options)
56
+ ```
57
+
58
+ Fetching videos for authenticated user (authentication required):
59
+ ```ruby
60
+ api.videos
61
+ ```
62
+
63
+ Removing video from vzaar: (authentication required)
64
+ ```ruby
65
+ api.delete(video_id)
66
+ ```
67
+
68
+ Updating existing video (authentication required):
69
+ ```ruby
70
+ api.edit_video(video_id, options)
71
+
72
+ # options are: title, description, private and seo_url
73
+ ```
74
+
75
+ Uploading new video to vzaar (authentication required):
76
+ ```ruby
77
+ api.upload_video(options)
78
+
79
+ # options are: path, url, title, description, profile, transcoding, replace_id,
80
+ # width and bitrate
81
+ #
82
+ # e.g api.upload(path: "./path/to/video.mp4", title: "my video")
83
+ #
84
+ # For link upload use url param:
85
+ # api.upload_video(url: "http://example.com/video.mp4", title: "my video")
86
+ ```
87
+
88
+ Uploading new thumbnail for video (authentication required):
89
+ ```ruby
90
+ api.upload_thumbnail(video_id, opts={})
91
+
92
+ # e.g api.upload_thumbnail(123456, path: "/path/to/image.jpg")
93
+ ```
94
+
95
+ Getting guid and aws signature (authentication required):
96
+ ```ruby
97
+ api.signature
98
+ ```
99
+
100
+ ### Previous versions of vzaar gem
101
+
102
+ This version is not backwards compatible with any of the previous versions of vzaar gem (0.2.x series)
103
+ 0.2.x series is no longer maintained.
104
+
105
+
106
+ ### Contributing
107
+
108
+ 1. Fork it
109
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
110
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
111
+ 4. Push to the branch (`git push origin my-new-feature`)
112
+ 5. Create new Pull Request
@@ -0,0 +1,8 @@
1
+ # uncomment these lines when this library is gemified
2
+ # require 'bundler/gem_tasks'
3
+ # Bundler::GemHelper.install_tasks
4
+
5
+ desc "Run all specs"
6
+ task :default do
7
+ exec 'rspec spec'
8
+ end
@@ -1,67 +1,75 @@
1
- # == Vzaar API gem
2
- # The Vzaar API provides means to access and manage resources on http://vzaar.com
3
- #
4
- # See README file for installation details.
5
- #
6
- # Author:: Mariusz Lusiak <mailto:mariusz@applicake.com>
7
-
8
- require 'rubygems'
9
- require 'httpclient'
10
- require 'logger'
11
- require 'oauth/consumer'
12
- require 'rexml/document'
13
- require 'vzaar/account_type'
14
- require 'vzaar/base'
15
- require 'vzaar/errors'
16
- require 'vzaar/user'
17
- require 'vzaar/signature'
18
- require 'vzaar/video'
19
- require 'vzaar/video_details'
1
+ $: << File.dirname(__FILE__)
20
2
 
21
3
  module Vzaar
4
+ module Helper
5
+ def blank?(obj)
6
+ obj.nil? or obj == ""
7
+ end
22
8
 
23
- VZAAR_LIVE_SERVER = 'vzaar.com'
9
+ def symb_keys(hash)
10
+ h = {}
11
+ hash.each_pair do |k,v|
12
+ h[k.to_sym] = v.is_a?(Hash) ? symb_keys(v) : v
13
+ end
14
+ h
15
+ end
16
+ end
24
17
 
25
- HTTP_GET = 'GET'
26
- HTTP_POST = 'POST'
27
- HTTP_DELETE = 'DELETE'
28
- HTTP_PUT = 'PUT'
18
+ class Error < StandardError; end
19
+ end
29
20
 
30
- HTTP_OK = "200"
31
- HTTP_CREATED = "201"
21
+ require 'httpclient'
22
+ require 'nokogiri'
23
+ require 'oauth'
24
+ require 'json'
32
25
 
33
- HTTP_FORBIDDEN = "403"
34
- HTTP_NOT_FOUND = "404"
35
26
 
36
- HTTP_BAD_GATEWAY = "502"
27
+ require 'vzaar/request/multipart'
28
+ require 'vzaar/ext/oauth'
29
+ require 'vzaar/connection'
30
+ require 'vzaar/request/base'
37
31
 
38
- class << self
32
+ # resources
39
33
 
40
- attr_accessor :connection
34
+ require 'vzaar/resources/base'
35
+ require 'vzaar/resources/account_type'
41
36
 
42
- @connection = nil
43
37
 
44
- # Use the method to create global connection to vzaar.
45
- #
46
- # Usage:
47
- # * Vzaar.connect! :login => 'Your vzaar login', :application_token => 'Your vzaar application token', :server => 'The vzaar server (vzaar.com by default)'
48
- def connect!(options = {})
49
- @connection = Base.new options
50
- end
38
+ require 'vzaar/resources/user'
39
+ require 'vzaar/resources/video'
40
+ require 'vzaar/resources/video_status'
41
+ require 'vzaar/resources/video_details'
42
+ require 'vzaar/resources/video_collection_item'
43
+ require 'vzaar/resources/video_collection'
44
+ require 'vzaar/resources/signature'
45
+ require 'vzaar/resources/processed_video'
46
+ require 'vzaar/resources/who_am_i'
47
+ require 'vzaar/resources/link_upload'
48
+ require 'vzaar/resources/upload_thumbnail'
51
49
 
52
- # Enables Rails specifc views and controllers used by vzaar uploader.
53
- def enable_uploader
54
- return if ActionView::Base.instance_methods.include? 'vzaar_basic_uploader'
55
- require 'rails/views/view_helpers'
56
- ActionView::Base.send :include, Vzaar::ViewHelpers
57
- controllers_path = "#{File.dirname(__FILE__)}/rails/controllers"
58
- ActiveSupport::Dependencies.load_paths << controllers_path
59
- end
50
+ # request
60
51
 
61
- end
62
-
63
- end
52
+ require 'vzaar/request/video'
53
+ require 'vzaar/request/video_details'
54
+ require 'vzaar/request/who_am_i'
55
+ require 'vzaar/request/account_type'
56
+ require 'vzaar/request/user_details'
57
+ require 'vzaar/request/video_list'
58
+ require 'vzaar/request/delete_video'
59
+ require 'vzaar/request/upload_status'
60
+ require 'vzaar/request/link_upload'
61
+ require 'vzaar/request/upload_thumbnail'
64
62
 
65
- if defined?(Rails) and defined?(ActionController) and defined?(ActiveSupport)
66
- Vzaar.enable_uploader
67
- end
63
+ require 'vzaar/uploader'
64
+
65
+
66
+ # response
67
+
68
+ require 'vzaar/response/base'
69
+
70
+
71
+ require 'vzaar/request/edit_video'
72
+ require 'vzaar/request/process_video'
73
+ require 'vzaar/request/signature'
74
+ require 'vzaar/request/url'
75
+ require 'vzaar/api'
@@ -0,0 +1,63 @@
1
+ module Vzaar
2
+ class Api < Struct.new(:conn)
3
+
4
+ def whoami(opts={})
5
+ resource = Request::WhoAmI.new(conn, opts).execute
6
+ resource.login
7
+ end
8
+
9
+ def account_type(account_type_id, opts={})
10
+ _opts = opts.merge(account_type_id: account_type_id)
11
+ Request::AccountType.new(conn, _opts).execute
12
+ end
13
+
14
+ def user_details(login, opts={})
15
+ Request::UserDetails.new(conn, opts.merge(login: login)).execute
16
+ end
17
+
18
+ def video_details(video_id, opts={})
19
+ Request::VideoDetails.new(conn, opts.merge(video_id: video_id)).execute
20
+ end
21
+
22
+ def video_list(login, opts={})
23
+ Request::VideoList.new(conn, opts.merge(login: login)).execute
24
+ end
25
+
26
+ def videos(opts={})
27
+ video_list(conn.login, { authenticated: true, page: opts[:page] })
28
+ end
29
+
30
+ def delete_video(video_id, opts={})
31
+ Request::DeleteVideo.new(conn, opts.merge(video_id: video_id)).execute
32
+ end
33
+
34
+ def edit_video(video_id, opts={})
35
+ Request::EditVideo.new(conn, opts.merge(video_id: video_id)).execute
36
+ end
37
+
38
+ def signature(opts={})
39
+ Request::Signature.new(conn, opts).execute
40
+ end
41
+
42
+ def process_video(opts={})
43
+ Request::ProcessVideo.new(conn, opts).execute
44
+ end
45
+
46
+ def upload_video(opts={})
47
+ uploader = Uploader.new(conn, signature, opts)
48
+ uploader.upload do |u|
49
+ process_video(u.processing_params)
50
+ end
51
+ end
52
+
53
+ def upload_thumbnail(video_id, opts={})
54
+ Request::UploadThumbnail.new(conn, opts.merge(video_id: video_id)).execute
55
+ end
56
+
57
+ def link_upload(url, opts={})
58
+ sig = signature
59
+ _opts = opts.merge({ guid: sig.guid, key: sig.key, url: url })
60
+ Request::LinkUpload.new(conn, _opts).execute
61
+ end
62
+ end
63
+ end