cloudkey 0.0.2 → 0.0.3
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.
- data/Gemfile.lock +22 -12
- data/cloudkey.gemspec +6 -4
- data/lib/cloudkey.rb +10 -0
- data/lib/cloudkey/client.rb +10 -9
- data/lib/cloudkey/file.rb +4 -5
- data/lib/cloudkey/media.rb +52 -5
- data/lib/cloudkey/version.rb +1 -1
- data/spec/cloudkey/media_spec.rb +35 -0
- data/spec/cloudkey_spec.rb +7 -6
- data/spec/spec_helper.rb +14 -1
- data/spec/vcr_cassettes/Cloudkey/Public_API.yml +75 -0
- data/spec/vcr_cassettes/Cloudkey_Media.yml +163 -0
- metadata +78 -50
- data/README.md +0 -26
data/Gemfile.lock
CHANGED
@@ -1,26 +1,36 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cloudkey (0.0.
|
5
|
-
curb (~> 0.
|
4
|
+
cloudkey (0.0.3)
|
5
|
+
curb (~> 0.8.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
addressable (2.2.6)
|
11
|
+
crack (0.3.1)
|
12
|
+
curb (0.8.0)
|
13
|
+
diff-lcs (1.1.3)
|
14
|
+
rake (0.9.2.2)
|
15
|
+
rspec (2.8.0)
|
16
|
+
rspec-core (~> 2.8.0)
|
17
|
+
rspec-expectations (~> 2.8.0)
|
18
|
+
rspec-mocks (~> 2.8.0)
|
19
|
+
rspec-core (2.8.0)
|
20
|
+
rspec-expectations (2.8.0)
|
18
21
|
diff-lcs (~> 1.1.2)
|
19
|
-
rspec-mocks (2.
|
22
|
+
rspec-mocks (2.8.0)
|
23
|
+
vcr (2.0.0.rc1)
|
24
|
+
webmock (1.7.10)
|
25
|
+
addressable (~> 2.2, > 2.2.5)
|
26
|
+
crack (>= 0.1.7)
|
20
27
|
|
21
28
|
PLATFORMS
|
22
29
|
ruby
|
23
30
|
|
24
31
|
DEPENDENCIES
|
25
32
|
cloudkey!
|
26
|
-
|
33
|
+
rake
|
34
|
+
rspec (~> 2.8.0)
|
35
|
+
vcr (~> 2.0.0.rc1)
|
36
|
+
webmock (~> 1.7.10)
|
data/cloudkey.gemspec
CHANGED
@@ -13,13 +13,15 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = %q{Client library to access DailymotionCloud services}
|
14
14
|
|
15
15
|
s.rubyforge_project = "cloudkey"
|
16
|
-
s.rdoc_options = ["--line-numbers", "--main"
|
17
|
-
s.extra_rdoc_files = ["README.md"]
|
16
|
+
s.rdoc_options = ["--line-numbers", "--main"]
|
18
17
|
s.files = `git ls-files`.split("\n")
|
19
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
20
|
s.require_paths = ["lib"]
|
22
21
|
|
23
|
-
s.add_development_dependency "rspec", "~> 2.
|
24
|
-
s.
|
22
|
+
s.add_development_dependency "rspec", "~> 2.8.0"
|
23
|
+
s.add_development_dependency "webmock", "~> 1.7.10"
|
24
|
+
s.add_development_dependency "vcr", "~> 2.0.0.rc1"
|
25
|
+
s.add_development_dependency "rake"
|
26
|
+
s.add_dependency 'curb', "~> 0.8.0"
|
25
27
|
end
|
data/lib/cloudkey.rb
CHANGED
@@ -6,7 +6,17 @@ require 'cloudkey/security_policy'
|
|
6
6
|
require 'cloudkey/api'
|
7
7
|
|
8
8
|
module Cloudkey
|
9
|
+
@@verbose = false
|
10
|
+
|
9
11
|
def self.authenticate *args
|
10
12
|
API::new *args
|
11
13
|
end
|
14
|
+
|
15
|
+
def self.verbose= b
|
16
|
+
@@verbose = b
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.verbose?
|
20
|
+
@@verbose
|
21
|
+
end
|
12
22
|
end
|
data/lib/cloudkey/client.rb
CHANGED
@@ -5,36 +5,37 @@ module Cloudkey
|
|
5
5
|
def initialize api
|
6
6
|
@api = api
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def method_missing method_id, *args, &block
|
10
10
|
call(method_id, *args, &block)
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
protected
|
14
14
|
def call method, args={}
|
15
15
|
@request = create_request self.class.name.gsub("Cloudkey::",'').downcase, method, args
|
16
16
|
authenticate_request @request
|
17
|
-
|
18
|
-
curl do |c|
|
17
|
+
|
18
|
+
curl do |c|
|
19
19
|
c.http_post @request.to_json
|
20
20
|
JSON.parse c.body_str
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def authenticate_request request
|
25
25
|
request[:auth] = "#{@api.user_infos}:#{API::sign(@api.user_infos + API.normalize(request), @api.key)}"
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def curl url=nil, &block
|
29
29
|
c = Curl::Easy.new(url || @api.target) do |c|
|
30
30
|
c.useragent = "cloudkey-rb #{Cloudkey::VERSION}"
|
31
31
|
c.headers['Content-Type'] = "application/json"
|
32
32
|
c.proxy_url = @api.proxy if @api.proxy
|
33
|
+
c.verbose = Cloudkey.verbose?
|
33
34
|
end
|
34
|
-
|
35
|
+
|
35
36
|
yield c
|
36
37
|
end
|
37
|
-
|
38
|
+
|
38
39
|
def create_request name, method, args
|
39
40
|
{
|
40
41
|
:call => "#{name}.#{method}",
|
@@ -42,4 +43,4 @@ module Cloudkey
|
|
42
43
|
}
|
43
44
|
end
|
44
45
|
end
|
45
|
-
end
|
46
|
+
end
|
data/lib/cloudkey/file.rb
CHANGED
@@ -2,9 +2,8 @@ module Cloudkey
|
|
2
2
|
class File < Client
|
3
3
|
def upload_file path, &block
|
4
4
|
raise "File not found" unless ::File.exists? path
|
5
|
-
|
5
|
+
|
6
6
|
curl(fetch_upload_url) do |c|
|
7
|
-
puts "upload! #{c.url}"
|
8
7
|
c.multipart_form_post = true
|
9
8
|
c.headers = false
|
10
9
|
c.follow_location = true
|
@@ -19,11 +18,11 @@ module Cloudkey
|
|
19
18
|
JSON.parse c.body_str
|
20
19
|
end
|
21
20
|
end
|
22
|
-
|
21
|
+
|
23
22
|
protected
|
24
|
-
|
23
|
+
|
25
24
|
def fetch_upload_url
|
26
25
|
upload["result"]["url"]
|
27
26
|
end
|
28
27
|
end
|
29
|
-
end
|
28
|
+
end
|
data/lib/cloudkey/media.rb
CHANGED
@@ -1,13 +1,60 @@
|
|
1
1
|
module Cloudkey
|
2
2
|
class Media < Client
|
3
|
+
CDN_URL = 'http://cdn.dmcloud.net'
|
4
|
+
STATIC_URL = 'http://static.dmcloud.net'
|
5
|
+
PROTOCOLS = %w(hls rtmp hps http)
|
6
|
+
|
7
|
+
ProtocolError = Class.new(Exception)
|
8
|
+
|
3
9
|
def embedded_url id, security_level = SecurityPolicy.new
|
4
|
-
url = "#{@api.base_url}/embed/#{@api.user_id}/#{id}"
|
10
|
+
url = "#{@api.base_url}/embed/#{@api.user_id}/#{id}"
|
5
11
|
API.sign_url url, @api.key, security_level
|
6
12
|
end
|
7
|
-
|
8
|
-
def stream_url id, asset_name="mp4_h264_aac", security_level=SecurityPolicy.new,
|
9
|
-
|
13
|
+
|
14
|
+
def stream_url id, asset_name="mp4_h264_aac", security_level=SecurityPolicy.new, opts={}
|
15
|
+
opts = normalize_opts(opts)
|
16
|
+
|
17
|
+
# Switch to static cdn for thumbnails
|
18
|
+
if asset_name.match(/^jpeg_thumbnail/)
|
19
|
+
opts[:cdn_url] = STATIC_URL
|
20
|
+
|
21
|
+
ts = "-#{opts[:expires_in]}" if opts[:expires_in]
|
22
|
+
|
23
|
+
url = "#{opts[:cdn_url]}/#{@api.user_id}/#{id}/#{asset_name}/#{ts}/#{version}"
|
24
|
+
return url
|
25
|
+
end
|
26
|
+
|
27
|
+
extension = asset_name.split('_')[0]
|
28
|
+
extension = "f4m" if extension == 'f4f'
|
29
|
+
|
30
|
+
url = "#{opts[:cdn_url]}"
|
31
|
+
url << "/route"
|
32
|
+
url << "/#{opts[:protocol]}" if opts[:protocol] != ''
|
33
|
+
url << "/#{@api.user_id}/#{id}/#{asset_name}#{opts[:version]}.#{extension}"
|
34
|
+
|
10
35
|
API.sign_url url, @api.key, security_level
|
11
36
|
end
|
37
|
+
|
38
|
+
private
|
39
|
+
def normalize_opts opts
|
40
|
+
opts = {
|
41
|
+
:cdn_url => CDN_URL,
|
42
|
+
:protocol => ''
|
43
|
+
}.merge(opts)
|
44
|
+
|
45
|
+
# Raise an exception if unsupported protocol is used
|
46
|
+
raise ProtocolError if opts[:protocol] != '' && !PROTOCOLS.include?(opts[:protocol])
|
47
|
+
|
48
|
+
# Normalize version
|
49
|
+
opts[:version] = "-#{opts[:version]}" if opts[:version]
|
50
|
+
|
51
|
+
|
52
|
+
# Force http in these cases
|
53
|
+
if opts[:download] || opts[:filename]
|
54
|
+
opts[:protocol] = 'http'
|
55
|
+
end
|
56
|
+
|
57
|
+
opts
|
58
|
+
end
|
12
59
|
end
|
13
|
-
end
|
60
|
+
end
|
data/lib/cloudkey/version.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
describe Cloudkey::Media do
|
2
|
+
use_vcr_cassette
|
3
|
+
|
4
|
+
context "Using test account" do
|
5
|
+
before :each do
|
6
|
+
@cloudkey = Cloudkey.authenticate TEST_USER_ID, TEST_USER_KEY
|
7
|
+
end
|
8
|
+
|
9
|
+
context "Having a collection" do
|
10
|
+
it "should list four medias" do
|
11
|
+
@cloudkey.media.list(:fields => [:id], :per_page => 20)['result']['total'].should ==(4)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should get all the titles" do
|
15
|
+
@cloudkey.media.list(:fields => [:"meta.title"], :per_page => 20)['result']['list'].collect do |item|
|
16
|
+
item['meta']['title']
|
17
|
+
end.should have(4).items
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "Querying a single media" do
|
22
|
+
it "should have an embedded url" do
|
23
|
+
@cloudkey.media.embedded_url('4f33ddbc94a6f6517c001577').should include("http://api.dmcloud.net/embed/4f33d9c8f325e11c830016af/4f33ddbc94a6f6517c001577")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should have a stream url" do
|
27
|
+
@cloudkey.media.stream_url('4f33ddbc94a6f6517c001577').should include("http://cdn.dmcloud.net/route/4f33d9c8f325e11c830016af/4f33ddbc94a6f6517c001577/mp4_h264_aac.mp4")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should have http detected as protocol" do
|
31
|
+
@cloudkey.media.stream_url('4f33ddbc94a6f6517c001577', 'mp4_h264_aac',Cloudkey::SecurityPolicy.new, :download => true).should include("/http/")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/spec/cloudkey_spec.rb
CHANGED
@@ -2,24 +2,25 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Cloudkey do
|
4
4
|
context "Public API" do
|
5
|
+
use_vcr_cassette
|
6
|
+
|
5
7
|
it "should provide an authenticate method on Cloudkey" do
|
6
8
|
Cloudkey.should respond_to :authenticate
|
7
9
|
end
|
8
|
-
|
10
|
+
|
9
11
|
it "should count medias" do
|
10
|
-
|
11
|
-
@cloudkey = Cloudkey.authenticate "foo", "bar"
|
12
|
+
@cloudkey = Cloudkey.authenticate "4cad8cc994a6f66a9d000001", "e873406200f136c54b07acac615ec802bcc043e7"
|
12
13
|
@cloudkey.media.count
|
13
14
|
end
|
14
|
-
|
15
|
+
|
15
16
|
it "should accept an optional proxy" do
|
16
17
|
@proxy = "http://my.awesome.proxy.com:3128"
|
17
18
|
Cloudkey.authenticate("foo", "bar", :proxy => @proxy).proxy.should == @proxy
|
18
19
|
end
|
19
|
-
|
20
|
+
|
20
21
|
it "should accept an optional base_url" do
|
21
22
|
@base_url = "http://different.api.dmcloud.net"
|
22
23
|
Cloudkey.authenticate("foo", "bar", :base_url => @base_url).base_url.should == @base_url
|
23
24
|
end
|
24
25
|
end
|
25
|
-
end
|
26
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1 +1,14 @@
|
|
1
|
-
require 'cloudkey'
|
1
|
+
require 'cloudkey'
|
2
|
+
require 'vcr'
|
3
|
+
|
4
|
+
TEST_USER_ID = ""
|
5
|
+
TEST_USER_KEY = ""
|
6
|
+
|
7
|
+
VCR.configure do |config|
|
8
|
+
config.cassette_library_dir = 'spec/vcr_cassettes'
|
9
|
+
config.hook_into :webmock
|
10
|
+
end
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.extend VCR::RSpec::Macros
|
14
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api.dmcloud.net/api
|
6
|
+
body: ! '{"call":"media.count","args":{},"auth":"4cad8cc994a6f66a9d000001:4a02d0ba865c103f40bd1163661ba5c9"}'
|
7
|
+
headers:
|
8
|
+
Content-Type:
|
9
|
+
- application/json
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Server:
|
16
|
+
- nginx/1.0.6
|
17
|
+
Date:
|
18
|
+
- Fri, 10 Feb 2012 17:32:57 GMT
|
19
|
+
Content-Type:
|
20
|
+
- application/json
|
21
|
+
Transfer-Encoding:
|
22
|
+
- chunked
|
23
|
+
Connection:
|
24
|
+
- close
|
25
|
+
X-Response-Time:
|
26
|
+
- 0.411 ms
|
27
|
+
Access-Control-Allow-Origin:
|
28
|
+
- ! '*'
|
29
|
+
Access-Control-Allow-Headers:
|
30
|
+
- Origin, X-Requested-With, Content-Type, Accept
|
31
|
+
Set-Cookie:
|
32
|
+
- dmvk=1ecc0921ca224ea08f65f4f92a747b3e; Domain=.dmcloud.net; Path=/
|
33
|
+
X-Dc-Node:
|
34
|
+
- www-01
|
35
|
+
body: ! '{"error": {"message": "''Media'' object has no attribute ''count''",
|
36
|
+
"code": 620}}'
|
37
|
+
http_version: !!null
|
38
|
+
recorded_at: Fri, 10 Feb 2012 17:32:57 GMT
|
39
|
+
- request:
|
40
|
+
method: post
|
41
|
+
uri: http://api.dmcloud.net/api
|
42
|
+
body: ! '{"call":"media.count","args":{},"auth":"4cad8cc994a6f66a9d000001:4a02d0ba865c103f40bd1163661ba5c9"}'
|
43
|
+
headers:
|
44
|
+
Content-Type:
|
45
|
+
- application/json
|
46
|
+
response:
|
47
|
+
status:
|
48
|
+
code: 200
|
49
|
+
message: OK
|
50
|
+
headers:
|
51
|
+
Server:
|
52
|
+
- nginx/1.0.6
|
53
|
+
Date:
|
54
|
+
- Fri, 10 Feb 2012 17:32:57 GMT
|
55
|
+
Content-Type:
|
56
|
+
- application/json
|
57
|
+
Transfer-Encoding:
|
58
|
+
- chunked
|
59
|
+
Connection:
|
60
|
+
- close
|
61
|
+
X-Response-Time:
|
62
|
+
- 0.411 ms
|
63
|
+
Access-Control-Allow-Origin:
|
64
|
+
- ! '*'
|
65
|
+
Access-Control-Allow-Headers:
|
66
|
+
- Origin, X-Requested-With, Content-Type, Accept
|
67
|
+
Set-Cookie:
|
68
|
+
- dmvk=1ecc0921ca224ea08f65f4f92a747b3e; Domain=.dmcloud.net; Path=/
|
69
|
+
X-Dc-Node:
|
70
|
+
- www-01
|
71
|
+
body: ! '{"error": {"message": "''Media'' object has no attribute ''count''",
|
72
|
+
"code": 620}}'
|
73
|
+
http_version: !!null
|
74
|
+
recorded_at: Fri, 10 Feb 2012 17:32:57 GMT
|
75
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,163 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api.dmcloud.net/api
|
6
|
+
body: ! '{"call":"media.list","args":{"fields":["meta.title"],"per_page":20},"auth":":f588b19a1e8a9e6c65a88ae37ec2dd1a"}'
|
7
|
+
headers:
|
8
|
+
Content-Type:
|
9
|
+
- application/json
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Server:
|
16
|
+
- nginx/1.0.6
|
17
|
+
Date:
|
18
|
+
- Fri, 10 Feb 2012 17:32:57 GMT
|
19
|
+
Content-Type:
|
20
|
+
- application/json
|
21
|
+
Transfer-Encoding:
|
22
|
+
- chunked
|
23
|
+
Connection:
|
24
|
+
- close
|
25
|
+
X-Response-Time:
|
26
|
+
- 4.233 ms
|
27
|
+
Access-Control-Allow-Origin:
|
28
|
+
- ! '*'
|
29
|
+
Access-Control-Allow-Headers:
|
30
|
+
- Origin, X-Requested-With, Content-Type, Accept
|
31
|
+
Set-Cookie:
|
32
|
+
- dmvk=f7847df6ed2f4c3c82708ed0a831961b; Domain=.dmcloud.net; Path=/
|
33
|
+
X-Dc-Node:
|
34
|
+
- www-01
|
35
|
+
body: ! '{"result": {"list": [{"meta": {"title": "Comment ajouter des informations
|
36
|
+
sur un graphique avec excel 2007"}}, {"meta": {"title": "Comment ajuster la
|
37
|
+
taille des colonnes et des lignes avec excel 2007"}}, {"meta": {"title": "Comment
|
38
|
+
ajouter des en-t\u00eates et des pieds de page avec excel 2007"}}, {"meta":
|
39
|
+
{"title": "Comment ajuster un tableau sur une page avec excel 2007"}}], "pages":
|
40
|
+
1, "on_this_page": 4, "per_page": 20, "total": 4, "page": 1}}'
|
41
|
+
http_version: !!null
|
42
|
+
recorded_at: Fri, 10 Feb 2012 17:32:57 GMT
|
43
|
+
- request:
|
44
|
+
method: post
|
45
|
+
uri: http://api.dmcloud.net/api
|
46
|
+
body: ! '{"call":"media.list","args":{"fields":["meta.title"],"per_page":20},"auth":"4f33d9c8f325e11c830016af:f588b19a1e8a9e6c65a88ae37ec2dd1a"}'
|
47
|
+
headers:
|
48
|
+
Content-Type:
|
49
|
+
- application/json
|
50
|
+
response:
|
51
|
+
status:
|
52
|
+
code: 200
|
53
|
+
message: OK
|
54
|
+
headers:
|
55
|
+
Server:
|
56
|
+
- nginx/1.0.6
|
57
|
+
Date:
|
58
|
+
- Fri, 10 Feb 2012 17:32:57 GMT
|
59
|
+
Content-Type:
|
60
|
+
- application/json
|
61
|
+
Transfer-Encoding:
|
62
|
+
- chunked
|
63
|
+
Connection:
|
64
|
+
- close
|
65
|
+
X-Response-Time:
|
66
|
+
- 4.233 ms
|
67
|
+
Access-Control-Allow-Origin:
|
68
|
+
- ! '*'
|
69
|
+
Access-Control-Allow-Headers:
|
70
|
+
- Origin, X-Requested-With, Content-Type, Accept
|
71
|
+
Set-Cookie:
|
72
|
+
- dmvk=f7847df6ed2f4c3c82708ed0a831961b; Domain=.dmcloud.net; Path=/
|
73
|
+
X-Dc-Node:
|
74
|
+
- www-01
|
75
|
+
body: ! '{"result": {"list": [{"meta": {"title": "Comment ajouter des informations
|
76
|
+
sur un graphique avec excel 2007"}}, {"meta": {"title": "Comment ajuster la
|
77
|
+
taille des colonnes et des lignes avec excel 2007"}}, {"meta": {"title": "Comment
|
78
|
+
ajouter des en-t\u00eates et des pieds de page avec excel 2007"}}, {"meta":
|
79
|
+
{"title": "Comment ajuster un tableau sur une page avec excel 2007"}}], "pages":
|
80
|
+
1, "on_this_page": 4, "per_page": 20, "total": 4, "page": 1}}'
|
81
|
+
http_version: !!null
|
82
|
+
recorded_at: Fri, 10 Feb 2012 17:32:57 GMT
|
83
|
+
- request:
|
84
|
+
method: post
|
85
|
+
uri: http://api.dmcloud.net/api
|
86
|
+
body: ! '{"call":"media.list","args":{"fields":["meta.title"],"per_page":20},"auth":"4f33d9c8f325e11c830016af:f588b19a1e8a9e6c65a88ae37ec2dd1a"}'
|
87
|
+
headers:
|
88
|
+
Content-Type:
|
89
|
+
- application/json
|
90
|
+
response:
|
91
|
+
status:
|
92
|
+
code: 200
|
93
|
+
message: OK
|
94
|
+
headers:
|
95
|
+
Server:
|
96
|
+
- nginx/1.0.6
|
97
|
+
Date:
|
98
|
+
- Fri, 10 Feb 2012 17:32:57 GMT
|
99
|
+
Content-Type:
|
100
|
+
- application/json
|
101
|
+
Transfer-Encoding:
|
102
|
+
- chunked
|
103
|
+
Connection:
|
104
|
+
- close
|
105
|
+
X-Response-Time:
|
106
|
+
- 4.127 ms
|
107
|
+
Access-Control-Allow-Origin:
|
108
|
+
- ! '*'
|
109
|
+
Access-Control-Allow-Headers:
|
110
|
+
- Origin, X-Requested-With, Content-Type, Accept
|
111
|
+
Set-Cookie:
|
112
|
+
- dmvk=5db2b968588f4e3fa9b9f9c8c4f0f22e; Domain=.dmcloud.net; Path=/
|
113
|
+
X-Dc-Node:
|
114
|
+
- www-01
|
115
|
+
body: ! '{"result": {"list": [{"meta": {"title": "Comment ajouter des informations
|
116
|
+
sur un graphique avec excel 2007"}}, {"meta": {"title": "Comment ajuster la
|
117
|
+
taille des colonnes et des lignes avec excel 2007"}}, {"meta": {"title": "Comment
|
118
|
+
ajouter des en-t\u00eates et des pieds de page avec excel 2007"}}, {"meta":
|
119
|
+
{"title": "Comment ajuster un tableau sur une page avec excel 2007"}}], "pages":
|
120
|
+
1, "on_this_page": 4, "per_page": 20, "total": 4, "page": 1}}'
|
121
|
+
http_version: !!null
|
122
|
+
recorded_at: Fri, 10 Feb 2012 17:32:57 GMT
|
123
|
+
- request:
|
124
|
+
method: post
|
125
|
+
uri: http://api.dmcloud.net/api
|
126
|
+
body: ! '{"call":"media.list","args":{"fields":["meta.title"],"per_page":20},"auth":"4f33d9c8f325e11c830016af:f588b19a1e8a9e6c65a88ae37ec2dd1a"}'
|
127
|
+
headers:
|
128
|
+
Content-Type:
|
129
|
+
- application/json
|
130
|
+
response:
|
131
|
+
status:
|
132
|
+
code: 200
|
133
|
+
message: OK
|
134
|
+
headers:
|
135
|
+
Server:
|
136
|
+
- nginx/1.0.6
|
137
|
+
Date:
|
138
|
+
- Fri, 10 Feb 2012 17:32:57 GMT
|
139
|
+
Content-Type:
|
140
|
+
- application/json
|
141
|
+
Transfer-Encoding:
|
142
|
+
- chunked
|
143
|
+
Connection:
|
144
|
+
- close
|
145
|
+
X-Response-Time:
|
146
|
+
- 4.127 ms
|
147
|
+
Access-Control-Allow-Origin:
|
148
|
+
- ! '*'
|
149
|
+
Access-Control-Allow-Headers:
|
150
|
+
- Origin, X-Requested-With, Content-Type, Accept
|
151
|
+
Set-Cookie:
|
152
|
+
- dmvk=5db2b968588f4e3fa9b9f9c8c4f0f22e; Domain=.dmcloud.net; Path=/
|
153
|
+
X-Dc-Node:
|
154
|
+
- www-01
|
155
|
+
body: ! '{"result": {"list": [{"meta": {"title": "Comment ajouter des informations
|
156
|
+
sur un graphique avec excel 2007"}}, {"meta": {"title": "Comment ajuster la
|
157
|
+
taille des colonnes et des lignes avec excel 2007"}}, {"meta": {"title": "Comment
|
158
|
+
ajouter des en-t\u00eates et des pieds de page avec excel 2007"}}, {"meta":
|
159
|
+
{"title": "Comment ajuster un tableau sur une page avec excel 2007"}}], "pages":
|
160
|
+
1, "on_this_page": 4, "per_page": 20, "total": 4, "page": 1}}'
|
161
|
+
http_version: !!null
|
162
|
+
recorded_at: Fri, 10 Feb 2012 17:32:57 GMT
|
163
|
+
recorded_with: VCR 2.0.0.rc1
|
metadata
CHANGED
@@ -1,51 +1,79 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudkey
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Jean-Hadrien Chabran
|
9
9
|
- Boubacar Diallo
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
dependencies:
|
17
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2012-02-10 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
18
16
|
name: rspec
|
17
|
+
requirement: &24973660 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.8.0
|
23
|
+
type: :development
|
19
24
|
prerelease: false
|
20
|
-
|
25
|
+
version_requirements: *24973660
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: webmock
|
28
|
+
requirement: &24973020 !ruby/object:Gem::Requirement
|
21
29
|
none: false
|
22
|
-
requirements:
|
30
|
+
requirements:
|
23
31
|
- - ~>
|
24
|
-
- !ruby/object:Gem::Version
|
25
|
-
version:
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.7.10
|
26
34
|
type: :development
|
27
|
-
version_requirements: *id001
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: curb
|
30
35
|
prerelease: false
|
31
|
-
|
36
|
+
version_requirements: *24973020
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: vcr
|
39
|
+
requirement: &24972340 !ruby/object:Gem::Requirement
|
32
40
|
none: false
|
33
|
-
requirements:
|
41
|
+
requirements:
|
34
42
|
- - ~>
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 0.
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.0.0.rc1
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *24972340
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rake
|
50
|
+
requirement: &24971760 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *24971760
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: curb
|
61
|
+
requirement: &24970880 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ~>
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.8.0
|
37
67
|
type: :runtime
|
38
|
-
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *24970880
|
39
70
|
description: Client library to access DailymotionCloud services
|
40
|
-
email:
|
71
|
+
email:
|
41
72
|
- jh@kareea.com
|
42
73
|
executables: []
|
43
|
-
|
44
74
|
extensions: []
|
45
|
-
|
46
|
-
|
47
|
-
- README.md
|
48
|
-
files:
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
49
77
|
- .gitignore
|
50
78
|
- Gemfile
|
51
79
|
- Gemfile.lock
|
@@ -62,42 +90,42 @@ files:
|
|
62
90
|
- lib/cloudkey/security_policy.rb
|
63
91
|
- lib/cloudkey/version.rb
|
64
92
|
- spec/cloudkey/api_spec.rb
|
93
|
+
- spec/cloudkey/media_spec.rb
|
65
94
|
- spec/cloudkey/security_policy_spec.rb
|
66
95
|
- spec/cloudkey_spec.rb
|
67
96
|
- spec/spec_helper.rb
|
68
|
-
-
|
69
|
-
|
97
|
+
- spec/vcr_cassettes/Cloudkey/Public_API.yml
|
98
|
+
- spec/vcr_cassettes/Cloudkey_Media.yml
|
70
99
|
homepage: http://github.com/kareea/cloudkey
|
71
100
|
licenses: []
|
72
|
-
|
73
101
|
post_install_message:
|
74
|
-
rdoc_options:
|
102
|
+
rdoc_options:
|
75
103
|
- --line-numbers
|
76
104
|
- --main
|
77
|
-
|
78
|
-
require_paths:
|
105
|
+
require_paths:
|
79
106
|
- lib
|
80
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
108
|
none: false
|
82
|
-
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version:
|
86
|
-
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
hash: 1976065340622520994
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
117
|
none: false
|
88
|
-
requirements:
|
89
|
-
- -
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version:
|
118
|
+
requirements:
|
119
|
+
- - ! '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
segments:
|
123
|
+
- 0
|
124
|
+
hash: 1976065340622520994
|
92
125
|
requirements: []
|
93
|
-
|
94
126
|
rubyforge_project: cloudkey
|
95
|
-
rubygems_version: 1.
|
127
|
+
rubygems_version: 1.8.10
|
96
128
|
signing_key:
|
97
129
|
specification_version: 3
|
98
130
|
summary: Client library to access DailymotionCloud services
|
99
|
-
test_files:
|
100
|
-
- spec/cloudkey/api_spec.rb
|
101
|
-
- spec/cloudkey/security_policy_spec.rb
|
102
|
-
- spec/cloudkey_spec.rb
|
103
|
-
- spec/spec_helper.rb
|
131
|
+
test_files: []
|
data/README.md
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
Cloudkey
|
2
|
-
========
|
3
|
-
|
4
|
-
Introduction
|
5
|
-
------------
|
6
|
-
|
7
|
-
This gem, still under development, aims to provide an abstract interface to DailyMotion's Cloud service.
|
8
|
-
Currently, it's mostly a rewrite of the Python version.
|
9
|
-
|
10
|
-
Usage
|
11
|
-
-----
|
12
|
-
|
13
|
-
# Fill in your credentials
|
14
|
-
@cloudkey = Cloudkey.authenticate USER_ID, KEY
|
15
|
-
|
16
|
-
# Grab a list of your medias
|
17
|
-
p @cloudkey.media.list(:fields => [:id])
|
18
|
-
|
19
|
-
# Get an embedded player for your video, with its usage restricted to a specific IP address
|
20
|
-
p @cloudkey.media.embedded_url VIDEO_ID, Cloudkey::SecurityPolicy.new(:ip => "88.0.0.1")
|
21
|
-
|
22
|
-
|
23
|
-
License
|
24
|
-
-------
|
25
|
-
|
26
|
-
CloudkeyRb is Copyright © 2010-2011 Kareea SARL. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
|