viddler-ruby 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -49,6 +49,14 @@ For an authenticated client, just call `authenticate!` on the client:
49
49
 
50
50
  Then, any calls made on `viddler` will be done using the correct session id.
51
51
 
52
+ If you want to record a video, you can request a record token during authentication:
53
+
54
+ viddler = Viddler::Client.new('your api key')
55
+ viddler.authenticate! 'username', 'password', true
56
+ puts viddler.record_token # => the record token from API
57
+
58
+ The API returns a record token that's available for you.
59
+
52
60
  Uploading
53
61
  ---------
54
62
 
@@ -12,7 +12,7 @@ module Viddler
12
12
  class Client
13
13
  DEFAULT_ENDPOINT = 'http://api.viddler.com/api/v2/'
14
14
 
15
- attr_accessor :api_key, :sessionid
15
+ attr_accessor :api_key, :sessionid, :record_token
16
16
 
17
17
  # Sets the API key and sessionid if needed for the given arguments
18
18
  #
@@ -57,8 +57,9 @@ module Viddler
57
57
  # viddler.authenticate! 'username', 'password'
58
58
  #
59
59
  # Returns a String sessionid
60
- def authenticate!(username, password)
61
- auth = get 'viddler.users.auth', :user => username, :password => password
60
+ def authenticate!(username, password, get_record_token=false)
61
+ auth = get 'viddler.users.auth', :user => username, :password => password, :get_record_token => (get_record_token ? 1 : 0)
62
+ self.record_token = auth['auth']['record_token'] if get_record_token
62
63
  self.sessionid = auth['auth']['sessionid']
63
64
  end
64
65
 
@@ -1,3 +1,3 @@
1
1
  module Viddler
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/spec/client_spec.rb CHANGED
@@ -17,7 +17,7 @@ describe Viddler::Client, "#authenticate!" do
17
17
  end
18
18
 
19
19
  it "calls GET viddler.users.auth with username and password" do
20
- @client.should_receive(:get).with('viddler.users.auth', :password => 'pass', :user => 'user')
20
+ @client.should_receive(:get).with('viddler.users.auth', :password => 'pass', :user => 'user', :get_record_token => 0)
21
21
  @client.authenticate! 'user', 'pass'
22
22
  end
23
23
 
@@ -26,6 +26,19 @@ describe Viddler::Client, "#authenticate!" do
26
26
  @client.sessionid.should == 'mysess'
27
27
  end
28
28
 
29
+ it "gets record token when requested" do
30
+ @client.stub!(:get).and_return({
31
+ 'auth' => {
32
+ 'sessionid' => 'mysess',
33
+ 'record_token' => 'token'
34
+ }
35
+ })
36
+
37
+ @client.authenticate!('user', 'pass', true)
38
+ @client.sessionid.should == 'mysess'
39
+ @client.record_token.should == 'token'
40
+ end
41
+
29
42
  it "returns sessionid" do
30
43
  @client.authenticate!('user', 'pass').should == 'mysess'
31
44
  end
metadata CHANGED
@@ -1,93 +1,67 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: viddler-ruby
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Kyle Slattery
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-01-21 00:00:00 -05:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rest-client
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70295495496080 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: json
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70295495496080
25
+ - !ruby/object:Gem::Dependency
26
+ name: json
27
+ requirement: &70295495495600 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
47
33
  type: :runtime
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: activesupport
51
34
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70295495495600
36
+ - !ruby/object:Gem::Dependency
37
+ name: activesupport
38
+ requirement: &70295495495100 !ruby/object:Gem::Requirement
53
39
  none: false
54
- requirements:
55
- - - ">"
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 2
60
- - 3
61
- - 0
40
+ requirements:
41
+ - - ! '>'
42
+ - !ruby/object:Gem::Version
62
43
  version: 2.3.0
63
44
  type: :runtime
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
66
- name: bundler
67
45
  prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70295495495100
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: &70295495494600 !ruby/object:Gem::Requirement
69
50
  none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 23
74
- segments:
75
- - 1
76
- - 0
77
- - 0
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
78
54
  version: 1.0.0
79
55
  type: :development
80
- version_requirements: *id004
56
+ prerelease: false
57
+ version_requirements: *70295495494600
81
58
  description: An API wrapper for Viddler's v2 API
82
- email:
59
+ email:
83
60
  - kyle@viddler.com
84
61
  executables: []
85
-
86
62
  extensions: []
87
-
88
63
  extra_rdoc_files: []
89
-
90
- files:
64
+ files:
91
65
  - .gitignore
92
66
  - Gemfile
93
67
  - LICENSE
@@ -102,41 +76,28 @@ files:
102
76
  - spec/client_spec.rb
103
77
  - spec/spec_helper.rb
104
78
  - viddler-ruby.gemspec
105
- has_rdoc: true
106
79
  homepage: http://github.com/viddler/viddler-ruby
107
80
  licenses: []
108
-
109
81
  post_install_message:
110
82
  rdoc_options: []
111
-
112
- require_paths:
83
+ require_paths:
113
84
  - lib
114
- required_ruby_version: !ruby/object:Gem::Requirement
85
+ required_ruby_version: !ruby/object:Gem::Requirement
115
86
  none: false
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- hash: 3
120
- segments:
121
- - 0
122
- version: "0"
123
- required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
92
  none: false
125
- requirements:
126
- - - ">="
127
- - !ruby/object:Gem::Version
128
- hash: 23
129
- segments:
130
- - 1
131
- - 3
132
- - 6
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
133
96
  version: 1.3.6
134
97
  requirements: []
135
-
136
98
  rubyforge_project: viddler-ruby
137
- rubygems_version: 1.4.1
99
+ rubygems_version: 1.8.11
138
100
  signing_key:
139
101
  specification_version: 3
140
102
  summary: An API wrapper for Viddler's v2 API
141
103
  test_files: []
142
-