viddler 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -1
- data/README.txt +8 -4
- data/lib/viddler/base.rb +20 -1
- data/lib/viddler/version.rb +1 -1
- data/test/test_viddler.rb +18 -8
- data/website/index.html +2 -2
- metadata +2 -2
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= Viddler.rb
|
2
2
|
|
3
|
-
* http://viddler.rubyforge.com
|
4
|
-
*
|
3
|
+
* Rubyforge profile: http://viddler.rubyforge.com
|
4
|
+
* Source code repository: https://apricode.svn.beanstalkapp.com/gems/trunk/viddler
|
5
5
|
|
6
6
|
== DESCRIPTION:
|
7
7
|
|
@@ -11,12 +11,12 @@ Ruby wrapper around Viddler.com[http://www.viddler.com] API.
|
|
11
11
|
|
12
12
|
Currently implemented API methods:
|
13
13
|
|
14
|
+
* viddler.videos.getRecordToken
|
14
15
|
* viddler.users.register
|
15
16
|
* viddler.users.auth
|
16
17
|
* viddler.users.getProfile
|
17
18
|
* viddler.users.setProfile
|
18
19
|
* viddler.users.setOptions
|
19
|
-
* viddler.videos.getRecordToken
|
20
20
|
* viddler.videos.upload
|
21
21
|
* viddler.videos.getStatus
|
22
22
|
* viddler.videos.getDetails
|
@@ -28,7 +28,7 @@ Currently implemented API methods:
|
|
28
28
|
|
29
29
|
== NOT YET IMPLEMENTED:
|
30
30
|
|
31
|
-
*
|
31
|
+
* Wrapper for video permissions.
|
32
32
|
|
33
33
|
== REQUIREMENTS:
|
34
34
|
|
@@ -40,6 +40,10 @@ Currently implemented API methods:
|
|
40
40
|
|
41
41
|
* sudo gem install viddler
|
42
42
|
|
43
|
+
== CONTACT:
|
44
|
+
|
45
|
+
* ilya dot sabanin at gmail.com
|
46
|
+
|
43
47
|
== LICENSE:
|
44
48
|
|
45
49
|
(The MIT License)
|
data/lib/viddler/base.rb
CHANGED
@@ -48,7 +48,7 @@ module Viddler
|
|
48
48
|
#
|
49
49
|
# @viddler.authenticate
|
50
50
|
#
|
51
|
-
# Returns
|
51
|
+
# Returns a string with session id.
|
52
52
|
#
|
53
53
|
def authenticate
|
54
54
|
raise AuthenticationRequiredError unless could_authenticate?
|
@@ -65,6 +65,25 @@ module Viddler
|
|
65
65
|
@session_id ? true : false
|
66
66
|
end
|
67
67
|
|
68
|
+
# Implements <tt>viddler.videos.getRecordToken[http://wiki.developers.viddler.com/index.php/Viddler.videos.getRecordToken]</tt>.
|
69
|
+
#
|
70
|
+
# Example:
|
71
|
+
#
|
72
|
+
# @viddler.get_record_token
|
73
|
+
#
|
74
|
+
# Returns a string with record token.
|
75
|
+
#
|
76
|
+
def get_record_token
|
77
|
+
authenticate unless authenticated?
|
78
|
+
|
79
|
+
request = Viddler::Request.new(:get, 'videos.getRecordToken')
|
80
|
+
request.run do |p|
|
81
|
+
p.api_key = @api_key
|
82
|
+
p.sessionid = @session_id
|
83
|
+
end
|
84
|
+
request.response['record_token']
|
85
|
+
end
|
86
|
+
|
68
87
|
# Implements <tt>viddler.users.register[http://wiki.developers.viddler.com/index.php/Viddler.users.register]</tt>. <b>Restricted to Viddler qualified API keys only.</b>
|
69
88
|
#
|
70
89
|
# <tt>new_attributes</tt> hash should contain next required keys:
|
data/lib/viddler/version.rb
CHANGED
data/test/test_viddler.rb
CHANGED
@@ -2,18 +2,22 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
2
2
|
|
3
3
|
class ViddlerTest < Test::Unit::TestCase
|
4
4
|
class KeyRequired < Exception
|
5
|
-
def message
|
5
|
+
def message
|
6
|
+
'In order to run this test, insert working Viddler API key inside API_KEY constant.'
|
7
|
+
end
|
6
8
|
end
|
7
9
|
|
8
10
|
class CredentialsRequired < Exception
|
9
|
-
def message
|
11
|
+
def message
|
12
|
+
'In order to run this test, insert working Viddler username and password inside LOGIN and PASSWORD constants.'
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
16
|
# In order to run the tests you need a working Viddler account and an API key.
|
13
17
|
API_KEY = nil
|
14
18
|
LOGIN = nil
|
15
19
|
PASSWORD = nil
|
16
|
-
TEST_VIDEO_FILE_PATH = '/
|
20
|
+
TEST_VIDEO_FILE_PATH = '/path/to/video'
|
17
21
|
|
18
22
|
def setup
|
19
23
|
raise KeyRequired unless API_KEY
|
@@ -26,11 +30,17 @@ class ViddlerTest < Test::Unit::TestCase
|
|
26
30
|
assert @viddler.authenticated?
|
27
31
|
end
|
28
32
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
def test_should_get_record_token
|
34
|
+
credentials_required
|
35
|
+
token = @viddler.get_record_token
|
36
|
+
assert_kind_of String, token
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_should_upload_video
|
40
|
+
credentials_required
|
41
|
+
file = File.open(TEST_VIDEO_FILE_PATH)
|
42
|
+
video = @viddler.upload_video(:file => file, :title => 'Testing', :description => 'Bla', :tags => 'one, two, three')
|
43
|
+
end
|
34
44
|
|
35
45
|
def test_should_find_profile
|
36
46
|
user = @viddler.find_profile('ilya')
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>viddler</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/viddler"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/viddler" class="numbers">0.
|
36
|
+
<a href="http://rubyforge.org/projects/viddler" class="numbers">0.2.0</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ ‘viddler’</h1>
|
39
39
|
|
@@ -82,7 +82,7 @@
|
|
82
82
|
|
83
83
|
<p>Comments are welcome. Send an email to <a href="mailto:FIXME"><span class="caps">FIXME</span> full name</a> email via the <a href="http://groups.google.com/group/viddler">forum</a></p>
|
84
84
|
<p class="coda">
|
85
|
-
<a href="FIXME email">FIXME full name</a>,
|
85
|
+
<a href="FIXME email">FIXME full name</a>, 17th April 2008<br>
|
86
86
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
87
87
|
</p>
|
88
88
|
</div>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: viddler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Sabanin
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-04-
|
12
|
+
date: 2008-04-18 00:00:00 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|