dm_cloud 0.0.55 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +14 -2
- data/README.md +12 -10
- data/Rakefile +52 -1
- data/VERSION +1 -0
- data/lib/dm_cloud/builder/media.rb +32 -33
- data/lib/dm_cloud/media.rb +11 -9
- data/lib/dm_cloud/request.rb +6 -7
- data/lib/dm_cloud/signing.rb +17 -17
- data/lib/dm_cloud/streaming.rb +17 -16
- data/lib/dm_cloud/version.rb +2 -2
- data/lib/dm_cloud.rb +6 -6
- data/spec/dm_cloud/media_spec.rb +48 -0
- data/spec/dm_cloud/signing_spec.rb +35 -0
- data/spec/dm_cloud/streaming_spec.rb +23 -0
- data/spec/dm_cloud_spec.rb +28 -0
- data/spec/spec_helper.rb +57 -0
- data/spec/vcr_cassettes/dm_cloud/dm_cloud_streaming.yml +0 -0
- data/spec/vcr_cassettes/dm_cloud_media.yml +163 -0
- metadata +137 -6
- data/dm_cloud.gemspec +0 -19
data/Gemfile
CHANGED
@@ -1,4 +1,16 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
2
5
|
|
3
|
-
#
|
4
|
-
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "rspec", "~> 2.8.0"
|
10
|
+
gem "rdoc", "~> 3.12"
|
11
|
+
gem "bundler"
|
12
|
+
gem "jeweler", "~> 1.8.4"
|
13
|
+
gem "rcov", ">= 0"
|
14
|
+
gem "vcr"
|
15
|
+
gem 'webmock', :git => "https://github.com/i0rek/webmock.git", :branch => "typhoeus_0.5.0"
|
16
|
+
end
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# DmCloud
|
2
2
|
|
3
3
|
I created this gem to simplify request and responses from DailyMotion Cloud API.
|
4
4
|
With this gem, you can :
|
@@ -11,8 +11,10 @@ With this gem, you can :
|
|
11
11
|
|
12
12
|
Add this line to your application's Gemfile:
|
13
13
|
|
14
|
-
gem 'dm_cloud'
|
15
|
-
|
14
|
+
gem 'dm_cloud', "0.0.60" #stable version
|
15
|
+
or
|
16
|
+
gem 'dm_cloud' # edge version
|
17
|
+
|
16
18
|
And then execute:
|
17
19
|
|
18
20
|
$ bundle
|
@@ -33,7 +35,7 @@ You can note the securitylevel, for more information about it, take a look at `l
|
|
33
35
|
DMC_SECRET = 'your api key'
|
34
36
|
DMC_SECURITY_LEVEL = :none
|
35
37
|
|
36
|
-
|
38
|
+
DmCloud.configure( {
|
37
39
|
:user_key => DMC_USER_ID,
|
38
40
|
:secret_key => DMC_SECRET,
|
39
41
|
:security_level => DMC_SECURITY_LEVEL
|
@@ -78,12 +80,12 @@ Description of security levels :
|
|
78
80
|
Second part, get you embed url :
|
79
81
|
It will return a string containing the iframe with the DailyMotion Cloud player.
|
80
82
|
|
81
|
-
|
83
|
+
DmCloud::Streaming.embed('your video id looks like a secret key')
|
82
84
|
|
83
85
|
Or how to get your direct url :
|
84
86
|
It will return a string containing the direct link to your file.
|
85
87
|
|
86
|
-
|
88
|
+
DmCloud::Streaming.url('your video id', ['asset_name'], {options})
|
87
89
|
|
88
90
|
The next parts will come soon, just need some time to finish it
|
89
91
|
and create corresponding tests.
|
@@ -93,14 +95,14 @@ and create corresponding tests.
|
|
93
95
|
|
94
96
|
If you need to list your video you can use this method :
|
95
97
|
|
96
|
-
|
98
|
+
DmCloud::Media.list({:page => 1, :per_page => 10})
|
97
99
|
It will return videos information and more :
|
98
100
|
|
99
101
|
result to yaml :
|
100
102
|
|
101
103
|
'{"result": {
|
102
104
|
"list": [{
|
103
|
-
"embed_url": "http://api.
|
105
|
+
"embed_url": "http://api.DmCloud.net/player/embed/:your_id/:media_id",
|
104
106
|
"assets": {
|
105
107
|
"source": {
|
106
108
|
"status": "ready",
|
@@ -114,7 +116,7 @@ result to yaml :
|
|
114
116
|
"video_bitrate": 1000618,
|
115
117
|
"created": 1347641702,
|
116
118
|
"audio_nbr_channel": 2,
|
117
|
-
"download_url": "http://cdn.
|
119
|
+
"download_url": "http://cdn.DmCloud.net/route/http/:your_id/:media_id/source-1347634502.mp4?filename=my_video_name-source-1347634502.mp4&auth=1351277028-3-672hcu1m-3fcab065b9bf103e70d3883aa8c657be",
|
118
120
|
"video_aspect": 1.7777777777777777,
|
119
121
|
"video_height": 576,
|
120
122
|
"audio_bitrate": 128017,
|
@@ -136,7 +138,7 @@ result to yaml :
|
|
136
138
|
|
137
139
|
As you can see, this give many information, you can submit a hash like this :
|
138
140
|
|
139
|
-
|
141
|
+
DmCloud::Media.list({:page => 1, :per_page => 10, :fields => {:meta => :title }, :assets => [:download_url, :created ]})
|
140
142
|
|
141
143
|
|
142
144
|
|
data/Rakefile
CHANGED
@@ -1 +1,52 @@
|
|
1
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
gem.name = "dm_cloud"
|
17
|
+
# gem.version = DmCloud::VERSION
|
18
|
+
gem.authors = ["Jeremy Mortelette"]
|
19
|
+
gem.email = ["mortelette.jeremy@gmail.com"]
|
20
|
+
gem.description = 'This gem will simplify usage of DailyMotion Cloud API, it represent api in ruby style, with automated handler for search and upload files'
|
21
|
+
gem.summary = 'Simplify DailyMotion Cloud API usage'
|
22
|
+
gem.homepage = ""
|
23
|
+
|
24
|
+
gem.files = `git ls-files`.split($/)
|
25
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
26
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
27
|
+
gem.require_paths = ["lib"]
|
28
|
+
end
|
29
|
+
|
30
|
+
Jeweler::RubygemsDotOrgTasks.new
|
31
|
+
|
32
|
+
require 'rspec/core'
|
33
|
+
require 'rspec/core/rake_task'
|
34
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
35
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
36
|
+
end
|
37
|
+
|
38
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
39
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
40
|
+
spec.rcov = true
|
41
|
+
end
|
42
|
+
|
43
|
+
task :default => :spec
|
44
|
+
#
|
45
|
+
# Rake::RDocTask.new do |rdoc|
|
46
|
+
# version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
47
|
+
#
|
48
|
+
# rdoc.rdoc_dir = 'rdoc'
|
49
|
+
# rdoc.title = "twits #{version}"
|
50
|
+
# rdoc.rdoc_files.include('README*')
|
51
|
+
# rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
+
# end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module DmCloud
|
2
2
|
module Builder
|
3
3
|
module Media
|
4
4
|
def self.create(url = '', assets_names = [], meta = {})
|
@@ -22,13 +22,12 @@ module DMCloud
|
|
22
22
|
request = Hash.new
|
23
23
|
|
24
24
|
# the media id
|
25
|
-
request[
|
26
|
-
request['fields'] = []
|
25
|
+
request[:fields] = []
|
27
26
|
|
28
27
|
# requested media meta datas
|
29
|
-
fields[:meta] = [
|
30
|
-
fields[:meta].each { |value| request[
|
31
|
-
request[
|
28
|
+
fields[:meta] = ['title'] unless fields[:meta]
|
29
|
+
fields[:meta].each { |value| request[:fields] << "meta.#{value.to_s}" }
|
30
|
+
request[:fields] += ['id', 'created', 'embed_url', 'frame_ratio']
|
32
31
|
|
33
32
|
# the worldwide statistics on the number of views
|
34
33
|
# request['fields'] << 'stats.global.last_week' if fields[:stats][:global]
|
@@ -46,7 +45,7 @@ module DMCloud
|
|
46
45
|
fields[:assets].each { |value| request << "assets.#{name}.#{value.to_s}" }
|
47
46
|
end
|
48
47
|
end
|
49
|
-
|
48
|
+
puts "request fields = #{request.to_yaml}"
|
50
49
|
request
|
51
50
|
end
|
52
51
|
|
@@ -54,11 +53,11 @@ module DMCloud
|
|
54
53
|
# raise StandardError, "missing :media_id in params" unless media_id
|
55
54
|
request = Hash.new
|
56
55
|
|
57
|
-
request[
|
56
|
+
request[:fields] = []
|
58
57
|
# requested media meta datas
|
59
|
-
fields[:meta] = [
|
60
|
-
fields[:meta].each { |value| request[
|
61
|
-
request[
|
58
|
+
fields[:meta] = ['title'] unless fields[:meta]
|
59
|
+
fields[:meta].each { |value| request[:fields] << "meta.#{value.to_s}" }
|
60
|
+
request[:fields] += ['id', 'created', 'embed_url', 'frame_ratio']
|
62
61
|
|
63
62
|
# TODO: handle global statistics request in another module
|
64
63
|
# the worldwide statistics on the number of views
|
@@ -74,7 +73,7 @@ module DMCloud
|
|
74
73
|
request = all_assets_fields(request, assets_names)
|
75
74
|
else
|
76
75
|
assets_names.each do |name|
|
77
|
-
fields[:assets].each { |value| request[
|
76
|
+
fields[:assets].each { |value| request[:fields] << "assets.#{name}.#{value.to_s}" }
|
78
77
|
end
|
79
78
|
end
|
80
79
|
|
@@ -88,27 +87,27 @@ module DMCloud
|
|
88
87
|
# It's also used as default if no fields params is submitted.
|
89
88
|
def self.all_assets_fields(request, assets_names)
|
90
89
|
assets_names.each do |name|
|
91
|
-
request[
|
92
|
-
request[
|
93
|
-
request[
|
94
|
-
request[
|
95
|
-
request[
|
96
|
-
request[
|
97
|
-
request[
|
98
|
-
request[
|
99
|
-
request[
|
100
|
-
request[
|
101
|
-
request[
|
102
|
-
request[
|
103
|
-
request[
|
104
|
-
request[
|
105
|
-
request[
|
106
|
-
request[
|
107
|
-
request[
|
108
|
-
request[
|
109
|
-
request[
|
110
|
-
request[
|
111
|
-
request[
|
90
|
+
request[:fields] << "assets.#{name}.download_url"
|
91
|
+
request[:fields] << "assets.#{name}.status"
|
92
|
+
request[:fields] << "assets.#{name}.container"
|
93
|
+
request[:fields] << "assets.#{name}.duration"
|
94
|
+
request[:fields] << "assets.#{name}.global_bitrate"
|
95
|
+
request[:fields] << "assets.#{name}.video_codec"
|
96
|
+
request[:fields] << "assets.#{name}.video_width"
|
97
|
+
request[:fields] << "assets.#{name}.video_height"
|
98
|
+
request[:fields] << "assets.#{name}.video_bitrate"
|
99
|
+
request[:fields] << "assets.#{name}.video_rotation"
|
100
|
+
request[:fields] << "assets.#{name}.video_fps"
|
101
|
+
request[:fields] << "assets.#{name}.video_fps_mode"
|
102
|
+
request[:fields] << "assets.#{name}.video_aspect"
|
103
|
+
request[:fields] << "assets.#{name}.video_interlaced"
|
104
|
+
request[:fields] << "assets.#{name}.audio_codec"
|
105
|
+
request[:fields] << "assets.#{name}.audio_bitrate"
|
106
|
+
request[:fields] << "assets.#{name}.audio_nbr_channel"
|
107
|
+
request[:fields] << "assets.#{name}.audio_samplerate"
|
108
|
+
request[:fields] << "assets.#{name}.created"
|
109
|
+
request[:fields] << "assets.#{name}.file_extension"
|
110
|
+
request[:fields] << "assets.#{name}.file_size"
|
112
111
|
end
|
113
112
|
request
|
114
113
|
end
|
data/lib/dm_cloud/media.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'dm_cloud/builder/media'
|
2
2
|
|
3
|
-
module
|
3
|
+
module DmCloud
|
4
4
|
class Media
|
5
5
|
# Creates a new media object.
|
6
6
|
# This method can either create an empty media object
|
@@ -22,7 +22,7 @@ module DMCloud
|
|
22
22
|
:call => call_type,
|
23
23
|
args: Builder::Media.create(options)
|
24
24
|
}
|
25
|
-
|
25
|
+
DmCloud.config[:auto_call] == true ? DmCloud::Request.execute(call_type, params) : {call: call_type, params: params}
|
26
26
|
end
|
27
27
|
|
28
28
|
# Delete a media object with all its associated assets.
|
@@ -32,13 +32,14 @@ module DMCloud
|
|
32
32
|
# Return :
|
33
33
|
# Nothing
|
34
34
|
def self.delete(media_id)
|
35
|
+
raise StandardError, "missing :media_id in params" unless media_id
|
35
36
|
call_type = "media.delete"
|
36
37
|
|
37
38
|
params = {
|
38
39
|
:call => call_type,
|
39
40
|
args: { id: media_id}
|
40
41
|
}
|
41
|
-
|
42
|
+
DmCloud.config[:auto_call] == true ? DmCloud::Request.execute(call_type, params) : {call: call_type, params: params}
|
42
43
|
end
|
43
44
|
|
44
45
|
# Gives information about a given media object.
|
@@ -48,14 +49,15 @@ module DMCloud
|
|
48
49
|
# fields (Array) – (required) the list of fields to retrieve.
|
49
50
|
# Returns:
|
50
51
|
# a multi-level structure containing about the media related to the requested fields.
|
51
|
-
def self.info(media_id, assets_names = ['source'], fields =
|
52
|
+
def self.info(media_id, assets_names = ['source'], fields = {})
|
53
|
+
raise StandardError, "missing :media_id in params" unless media_id
|
52
54
|
call_type = "media.info"
|
53
55
|
|
54
56
|
params = {
|
55
57
|
:call => call_type,
|
56
|
-
args:
|
58
|
+
args: DmCloud::Builder::Media.info(media_id, assets_names, fields)
|
57
59
|
}
|
58
|
-
|
60
|
+
DmCloud.config[:auto_call] == true ? DmCloud::Request.execute(call_type, params) : {call: call_type, params: params}
|
59
61
|
end
|
60
62
|
|
61
63
|
# Returns a paginated list of media info structures.
|
@@ -67,7 +69,7 @@ module DMCloud
|
|
67
69
|
# fields (Array) – (optional default return all informations) the fields to retrieve
|
68
70
|
# page (Integer) – (optional) the page number, default: 1
|
69
71
|
# per_page (Integer) – (optional) the number of objet per page, default: 10
|
70
|
-
# Returns:
|
72
|
+
# Returns:
|
71
73
|
# an object with information for the pagination and the result of the query.
|
72
74
|
def self.list(options = {})
|
73
75
|
call_type = "media.list"
|
@@ -77,11 +79,11 @@ module DMCloud
|
|
77
79
|
|
78
80
|
params = {
|
79
81
|
:call => call_type,
|
80
|
-
args:
|
82
|
+
args: DmCloud::Builder::Media.list(options),
|
81
83
|
:page => page,
|
82
84
|
:per_page => per_page
|
83
85
|
}
|
84
|
-
|
86
|
+
DmCloud.config[:auto_call] == true ? DmCloud::Request.execute(call_type, params) : {call: call_type, params: params}
|
85
87
|
end
|
86
88
|
|
87
89
|
end
|
data/lib/dm_cloud/request.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
require 'net/http'
|
2
|
+
require 'json'
|
2
3
|
|
3
|
-
module
|
4
|
+
module DmCloud
|
4
5
|
class Request
|
5
6
|
|
6
|
-
DAILYMOTION_API = 'http://api.
|
7
|
-
DAILYMOTION_STATIC = 'http://api.
|
7
|
+
DAILYMOTION_API = 'http://api.DmCloud.net/api'
|
8
|
+
DAILYMOTION_STATIC = 'http://api.DmCloud.net/api'
|
8
9
|
|
9
10
|
# This method control signing for Media calls and handle request and response.
|
10
11
|
def self.execute(call, params = {})
|
11
12
|
url = define(call)
|
12
|
-
params['auth'] =
|
13
|
+
params['auth'] = DmCloud::Signing.identify(params)
|
13
14
|
|
14
15
|
result = send_request(params)
|
15
16
|
parse_response(result)
|
@@ -21,11 +22,10 @@ module DMCloud
|
|
21
22
|
|
22
23
|
http = Net::HTTP.new(@uri.host, @uri.port)
|
23
24
|
request = Net::HTTP::Post.new(@uri.request_uri)
|
24
|
-
# request.basic_auth @uri.user, @uri.password
|
25
25
|
request.content_type = 'application/json'
|
26
26
|
request.body = params.to_json
|
27
27
|
|
28
|
-
puts 'request (YAML format ): ' + request.to_yaml + "\n" + '-' * 80
|
28
|
+
# puts 'request (YAML format ): ' + request.to_yaml + "\n" + '-' * 80
|
29
29
|
|
30
30
|
http.request(request).body
|
31
31
|
end
|
@@ -33,7 +33,6 @@ module DMCloud
|
|
33
33
|
|
34
34
|
|
35
35
|
def self.parse_response(result)
|
36
|
-
puts 'result : ' + result.to_yaml # For debugging, will be remove when test will exists
|
37
36
|
JSON.parse(result)
|
38
37
|
end
|
39
38
|
|
data/lib/dm_cloud/signing.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
module DmCloud
|
2
4
|
class Signing
|
3
5
|
# Generate auth token for request from Media
|
4
6
|
# Params:
|
@@ -7,16 +9,16 @@ module DMCloud
|
|
7
9
|
# return a string which contain the auth token for the request
|
8
10
|
# <url>?auth=<expires>-<sec>-<nonce>-<md5sum>[-<pub-sec-data>]
|
9
11
|
def self.identify(request)
|
10
|
-
user_id =
|
11
|
-
api_key =
|
12
|
-
|
12
|
+
user_id = DmCloud.config[:user_key]
|
13
|
+
api_key = DmCloud.config[:secret_key]
|
14
|
+
|
13
15
|
normalized_request = normalize(request).to_s
|
14
|
-
puts 'identify:: normalized_values : ' + normalized_request + "\n" + '-' * 80
|
15
|
-
|
16
|
+
# puts 'identify:: normalized_values : ' + normalized_request + "\n" + '-' * 80
|
17
|
+
|
16
18
|
params = user_id + normalized_request + api_key
|
17
|
-
|
18
|
-
puts 'identify:: Values before MD5 encrypt : ' + params + "\n" + '-' * 80
|
19
|
-
|
19
|
+
|
20
|
+
# puts 'identify:: Values before MD5 encrypt : ' + params + "\n" + '-' * 80
|
21
|
+
|
20
22
|
checksum = Digest::MD5.hexdigest(params)
|
21
23
|
auth_token = user_id + ':' + checksum
|
22
24
|
|
@@ -41,27 +43,25 @@ module DMCloud
|
|
41
43
|
# <url>?auth=<expires>-<sec>-<nonce>-<md5sum>[-<pub-sec-data>]
|
42
44
|
def self.sign(stream, security_datas = nil)
|
43
45
|
raise StandardError, "missing :stream in params" unless stream
|
44
|
-
sec_level = security(
|
45
|
-
sec_data = security_data(
|
46
|
+
sec_level = security(DmCloud.config[:security_level])
|
47
|
+
sec_data = security_data(DmCloud.config[:security_level], security_datas) unless security_datas.nil?
|
46
48
|
|
47
49
|
base = {
|
48
50
|
:sec_level => sec_level,
|
49
51
|
:url_no_query => stream,
|
50
|
-
:expires =>
|
52
|
+
:expires => 1.hours.from_now.to_i,
|
51
53
|
:nonce => SecureRandom.hex(16)[0,8],
|
52
|
-
:secret =>
|
54
|
+
:secret => DmCloud.config[:secret_key]
|
53
55
|
}
|
54
|
-
|
55
56
|
base.merge!(:sec_data => sec_data, :pub_sec_data => sec_data) unless sec_data.nil?
|
56
57
|
|
57
58
|
digest_struct = build_digest_struct(base)
|
58
|
-
|
59
59
|
check_sum = Digest::MD5.hexdigest(digest_struct)
|
60
60
|
|
61
61
|
signed_url = [base[:expires], base[:sec_level], base[:nonce], check_sum].compact
|
62
62
|
signed_url.merge!(:pub_sec_data => sec_data) unless sec_data.nil?
|
63
63
|
|
64
|
-
puts signed_url
|
64
|
+
# puts signed_url
|
65
65
|
|
66
66
|
signed_url = signed_url.join('-')
|
67
67
|
signed_url
|
@@ -107,7 +107,7 @@ module DMCloud
|
|
107
107
|
# but gathered and lock at the first use.
|
108
108
|
# Result :
|
109
109
|
# Return a string which contain the signed url like
|
110
|
-
# http://cdn.
|
110
|
+
# http://cdn.DmCloud.net/route/<user_id>/<media_id>/<asset_name>.<asset_extension>?auth=<auth_token>
|
111
111
|
def self.security(type = nil)
|
112
112
|
type = :none unless type
|
113
113
|
type = type.to_sym if type.class == String
|
data/lib/dm_cloud/streaming.rb
CHANGED
@@ -5,12 +5,13 @@ require 'digest/md5'
|
|
5
5
|
|
6
6
|
# This module generate methods to generate video's fluxes
|
7
7
|
# before signing it and request it.
|
8
|
-
module
|
8
|
+
module DmCloud
|
9
9
|
class Streaming
|
10
10
|
# Default URL to get embed content ou direct url
|
11
|
-
DIRECT_STREAM = '[PROTOCOL]://cdn.
|
12
|
-
EMBED_STREAM = '[PROTOCOL]://api.
|
11
|
+
DIRECT_STREAM = '[PROTOCOL]://cdn.DmCloud.net/route/[USER_ID]/[MEDIA_ID]/[ASSET_NAME].[ASSET_EXTENSION]'
|
12
|
+
EMBED_STREAM = '[PROTOCOL]://api.DmCloud.net/embed/[USER_ID]/[MEDIA_ID]?auth=[AUTH_TOKEN]&skin=[SKIN_ID]'
|
13
13
|
EMBED_IFRAME = '<iframe width=[WIDTH] height=[HEIGHT] frameborder="0" scrolling="no" src="[EMBED_URL]"></iframe>'
|
14
|
+
|
14
15
|
# Get embeded player
|
15
16
|
# Params :
|
16
17
|
# media_id: this is the id of the media (eg: 4c922386dede830447000009)
|
@@ -20,20 +21,20 @@ module DMCloud
|
|
20
21
|
# height: (optional) the height for the video player frame
|
21
22
|
# Result :
|
22
23
|
# return a string which contain the signed url like
|
23
|
-
# <iframe width="848" height="480" frameborder="0" scrolling="no" src="http://api.
|
24
|
+
# <iframe width="848" height="480" frameborder="0" scrolling="no" src="http://api.DmCloud.net/embed/<user_id>/<media_id>?auth=<auth_token>&skin=<skin_id>"></iframe>
|
24
25
|
def self.embed(media_id, options = {})
|
25
26
|
raise StandardError, "missing :media_id in params" unless media_id
|
26
27
|
|
27
|
-
skin_id = options[:skin_id]
|
28
|
-
width = options[:width]
|
29
|
-
height = options[:height]
|
28
|
+
skin_id = options[:skin_id] ? options[:skin_id] : 'modern1'
|
29
|
+
width = options[:width] ? options[:width] : '848'
|
30
|
+
height = options[:height] ? options[:height] : '480'
|
30
31
|
|
31
32
|
stream = EMBED_STREAM
|
32
|
-
stream.gsub!('[PROTOCOL]',
|
33
|
-
stream.gsub!('[USER_ID]',
|
33
|
+
stream.gsub!('[PROTOCOL]', DmCloud.config[:protocol])
|
34
|
+
stream.gsub!('[USER_ID]', DmCloud.config[:user_key])
|
34
35
|
stream.gsub!('[MEDIA_ID]', media_id)
|
35
36
|
stream.gsub!('[SKIN_ID]', skin_id)
|
36
|
-
stream += '?auth=[AUTH_TOKEN]'.gsub!('[AUTH_TOKEN]',
|
37
|
+
stream += '?auth=[AUTH_TOKEN]'.gsub!('[AUTH_TOKEN]', DmCloud::Signing.sign(stream))
|
37
38
|
|
38
39
|
frame = EMBED_IFRAME
|
39
40
|
frame.gsub!('[WIDTH]', width)
|
@@ -49,20 +50,20 @@ module DMCloud
|
|
49
50
|
# asset_extension: the extension of the asset, most of the time it is the first part of the asset name (eg: mp4)
|
50
51
|
# Result :
|
51
52
|
# return a string which contain the signed url like
|
52
|
-
# http://cdn.
|
53
|
+
# http://cdn.DmCloud.net/route/<user_id>/<media_id>/<asset_name>.<asset_extension>?auth=<auth_token>
|
53
54
|
def self.url(media_id, asset_name, asset_extension = nil)
|
54
|
-
asset_extension = asset_name.split('_').first unless asset_extension
|
55
|
-
|
56
55
|
raise StandardError, "missing :media_id in params" unless media_id
|
57
56
|
raise StandardError, "missing :asset_name in params" unless asset_name
|
57
|
+
asset_extension = asset_name.split('_').first unless asset_extension
|
58
58
|
|
59
59
|
stream = DIRECT_STREAM
|
60
|
-
stream.gsub!('[PROTOCOL]',
|
61
|
-
stream.gsub!('[USER_ID]',
|
60
|
+
stream.gsub!('[PROTOCOL]', DmCloud.config[:protocol])
|
61
|
+
stream.gsub!('[USER_ID]', DmCloud.config[:user_key])
|
62
62
|
stream.gsub!('[MEDIA_ID]', media_id)
|
63
63
|
stream.gsub!('[ASSET_NAME]', asset_name)
|
64
64
|
stream.gsub!('[ASSET_EXTENSION]', asset_extension)
|
65
|
-
|
65
|
+
|
66
|
+
stream += '?auth=[AUTH_TOKEN]'.gsub!('[AUTH_TOKEN]', DmCloud::Signing.sign(stream))
|
66
67
|
stream
|
67
68
|
end
|
68
69
|
end
|
data/lib/dm_cloud/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "0.0.
|
1
|
+
module DmCloud
|
2
|
+
VERSION = "0.0.65"
|
3
3
|
end
|
data/lib/dm_cloud.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
require "dm_cloud/version"
|
2
1
|
require 'yaml'
|
3
2
|
|
4
3
|
# This gem's comments come from DailyMotion Cloud API,
|
5
4
|
# that's the better way to see changes on new version and logic.
|
6
5
|
# For parts more generals and not representating DailyMotion Cloud API,
|
7
6
|
# I add some about my own opinion.
|
8
|
-
module
|
7
|
+
module DmCloud
|
9
8
|
|
10
9
|
# Configuration defaults
|
11
10
|
# I used this parts from Slainer68 paybox_system gem.
|
@@ -13,8 +12,11 @@ module DMCloud
|
|
13
12
|
# Thx Slainer68, I created my first gem,
|
14
13
|
# and next one will be an update to your paybox_system gem.
|
15
14
|
@@config = {
|
16
|
-
:
|
17
|
-
:
|
15
|
+
security_level: 'none',
|
16
|
+
protocol: 'http',
|
17
|
+
auto_call: true,
|
18
|
+
user_key: nil,
|
19
|
+
secret_key: nil
|
18
20
|
}
|
19
21
|
|
20
22
|
YAML_INITIALIZER_PATH = File.dirname(__FILE__)
|
@@ -41,8 +43,6 @@ module DMCloud
|
|
41
43
|
end
|
42
44
|
|
43
45
|
# Access to config variables (security level, user_id and api_key)
|
44
|
-
# NOTE: The unless @@config is not really interesting,
|
45
|
-
# this mean we should loose user credentials to API.
|
46
46
|
def self.config
|
47
47
|
@@config = configure unless @@config
|
48
48
|
@@config
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
require 'dm_cloud/media'
|
4
|
+
|
5
|
+
describe DmCloud::Media do
|
6
|
+
use_vcr_cassette
|
7
|
+
|
8
|
+
context "Using test account" do
|
9
|
+
before :each do
|
10
|
+
DmCloud.configure({:user_key => TEST_USER_KEY, :secret_key => TEST_SECRET_KEY, auto_call: false})
|
11
|
+
end
|
12
|
+
|
13
|
+
context "Having a collection" do
|
14
|
+
it "should list four medias" do
|
15
|
+
subject { list(:per_page => 20)['result']['total'].should == (4) }
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should get all the titles" do
|
19
|
+
result = DmCloud::Media.list(:fields => {:meta => [:title]}, :per_page => 20) #['result']['list']
|
20
|
+
result[:call].should == "media.list"
|
21
|
+
result[:params][:args][:fields].should include("meta.title")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should get page 2 with 2 records per page" do
|
25
|
+
result = DmCloud::Media.list(:per_page => 2, :page => 2)
|
26
|
+
result[:params][:page].should == 2
|
27
|
+
result[:params][:per_page].should == 2
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "Querying a single media" do
|
32
|
+
it "should have an default fields" do
|
33
|
+
result = DmCloud::Media.info('4f33ddbc94a6f6517c001577')
|
34
|
+
fields = result[:params][:args][:fields]
|
35
|
+
puts fields.to_yaml
|
36
|
+
fields.should include('embed_url')
|
37
|
+
end
|
38
|
+
|
39
|
+
# it "should have a stream url" do
|
40
|
+
# subject { stream_url('4f33ddbc94a6f6517c001577').should include("http://cdn.DmCloud.net/route/4f33d9c8f325e11c830016af/4f33ddbc94a6f6517c001577/mp4_h264_aac.mp4")
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
# it "should have http detected as protocol" do
|
44
|
+
# @cloudkey.media.stream_url('4f33ddbc94a6f6517c001577', 'mp4_h264_aac',Cloudkey::SecurityPolicy.new, :download => true).should include("/http/")
|
45
|
+
# end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require 'dm_cloud/signing'
|
3
|
+
|
4
|
+
describe DmCloud::Signing do
|
5
|
+
|
6
|
+
before do
|
7
|
+
DmCloud.configure({ :user_key => "hello world", :secret_key => "sEcReT_KeY" })
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should sign 'hello world' with sEcReT_KeY and returns 'b5d93121a6dc87562b46beb8ba809ace'" do
|
11
|
+
auth_token = subject { identify() }
|
12
|
+
auth_token.should == 'b5d93121a6dc87562b46beb8ba809ace'
|
13
|
+
end
|
14
|
+
|
15
|
+
it "it should sign an url" do
|
16
|
+
let(:signed_url) { stub(:sign).with("http://google.fr","olol") }
|
17
|
+
end
|
18
|
+
|
19
|
+
context "Normalizing" do
|
20
|
+
{
|
21
|
+
'foo42bar' => ['foo', 42, 'bar'],
|
22
|
+
'pink3red2yellow1' => {'yellow' => 1, 'red' => 2, 'pink' => 3},
|
23
|
+
'foo42pink3red2yellow1bar' => ['foo', 42, {'yellow' => 1, 'red' => 2, 'pink' => 3}, 'bar'],
|
24
|
+
'foo42pink3red2yellow1bar' => [:foo, 42, {:yellow => 1, :red => 2, :pink => 3}, :bar],
|
25
|
+
'12' => [nil, 1,2],
|
26
|
+
'' => nil,
|
27
|
+
'212345' => {2 => [nil, 1,2], 3 => nil, 4 => 5}
|
28
|
+
}.each do |normalized, original|
|
29
|
+
it "should normalize #{original.inspect} into #{normalized}" do
|
30
|
+
subject { normalize(original).should == normalized }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require 'dm_cloud/streaming'
|
3
|
+
|
4
|
+
|
5
|
+
describe DmCloud::Streaming do
|
6
|
+
use_vcr_cassette
|
7
|
+
|
8
|
+
context "check " do
|
9
|
+
before :each do
|
10
|
+
DmCloud.configure({user_key: TEST_USER_KEY, secret_key: TEST_SECRET_KEY, auto_execute: false})
|
11
|
+
end
|
12
|
+
|
13
|
+
context "Querying a single media" do
|
14
|
+
it "should have an embedded url" do
|
15
|
+
DmCloud::Streaming.embed('4f33ddbc94a6f6517c001577').should include("http://api.DmCloud.net/embed/4f33d9c8f325e11c830016af/4f33ddbc94a6f6517c001577")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should have a stream url" do
|
19
|
+
DmCloud::Streaming.url('4f33ddbc94a6f6517c001577', 'source').should include("http://cdn.DmCloud.net/route/4f33d9c8f325e11c830016af/4f33ddbc94a6f6517c001577/mp4_h264_aac.mp4")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'dm_cloud'
|
3
|
+
|
4
|
+
describe DmCloud do
|
5
|
+
context "configuration" do
|
6
|
+
use_vcr_cassette
|
7
|
+
|
8
|
+
it "should provide a config on DmCloud" do
|
9
|
+
DmCloud.should respond_to :config
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should be initialized with default values" do
|
13
|
+
DmCloud.configure
|
14
|
+
DmCloud.config[:security_level].should == 'none'
|
15
|
+
DmCloud.config[:protocol].should == 'http'
|
16
|
+
DmCloud.config[:auto_call].should be_true
|
17
|
+
end
|
18
|
+
|
19
|
+
context "after configuration setted" do
|
20
|
+
it "should be properly set" do
|
21
|
+
DmCloud.configure({user_key: TEST_USER_KEY, secret_key: TEST_SECRET_KEY, auto_call: false })
|
22
|
+
DmCloud.config[:user_key].should == TEST_USER_KEY
|
23
|
+
DmCloud.config[:secret_key].should == TEST_SECRET_KEY
|
24
|
+
DmCloud.config[:auto_call].should == false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '/../', 'lib'))
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rspec'
|
5
|
+
require 'rspec/autorun'
|
6
|
+
|
7
|
+
# Requires supporting files with custom matchers and macros, etc,
|
8
|
+
# in ./support/ and its subdirectories.
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
10
|
+
|
11
|
+
# def self.behavior(obj)
|
12
|
+
# if @methods
|
13
|
+
# @methods = @methods.select{|met| @methods.member? met }
|
14
|
+
# else
|
15
|
+
# @methods = obj.public_methods
|
16
|
+
# end
|
17
|
+
# end
|
18
|
+
# puts "Common Methods: #{@methods.sort.join(', ')}" if @methods
|
19
|
+
|
20
|
+
module Compare
|
21
|
+
def self.type(obj)
|
22
|
+
@objects ||= []
|
23
|
+
@objects << obj
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.report
|
27
|
+
puts "Object Types: #{@objects.collect{|o| o.class}.join(', ')}" if @objects
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class Object
|
32
|
+
def put_methods(regex=/.*/)
|
33
|
+
puts self.methods.grep(regex)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
RSpec.configure do |config|
|
38
|
+
config.after(:suite) do
|
39
|
+
Compare.report
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Hook on http requests
|
44
|
+
require 'vcr'
|
45
|
+
|
46
|
+
TEST_USER_KEY = "my_user_key"
|
47
|
+
TEST_SECRET_KEY = "my_secret_key"
|
48
|
+
|
49
|
+
VCR.configure do |c|
|
50
|
+
c.cassette_library_dir = 'spec/cassettes'
|
51
|
+
# c.stub_with :fakeweb
|
52
|
+
c.default_cassette_options = { :record => :new_episodes }
|
53
|
+
end
|
54
|
+
|
55
|
+
RSpec.configure do |c|
|
56
|
+
c.extend VCR::RSpec::Macros
|
57
|
+
end
|
File without changes
|
@@ -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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,136 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
13
|
-
dependencies:
|
12
|
+
date: 2012-11-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.8.0
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.8.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rdoc
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.12'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.12'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bundler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: jeweler
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.8.4
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.8.4
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rcov
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: vcr
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: webmock
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
14
126
|
description: This gem will simplify usage of DailyMotion Cloud API, it represent api
|
15
127
|
in ruby style, with automated handler for search and upload files
|
16
128
|
email:
|
17
129
|
- mortelette.jeremy@gmail.com
|
18
130
|
executables: []
|
19
131
|
extensions: []
|
20
|
-
extra_rdoc_files:
|
132
|
+
extra_rdoc_files:
|
133
|
+
- LICENSE.txt
|
134
|
+
- README.md
|
21
135
|
files:
|
22
136
|
- .gitignore
|
23
137
|
- Gemfile
|
24
138
|
- LICENSE.txt
|
25
139
|
- README.md
|
26
140
|
- Rakefile
|
27
|
-
-
|
141
|
+
- VERSION
|
28
142
|
- lib/dm_cloud.rb
|
29
143
|
- lib/dm_cloud/builder/media.rb
|
30
144
|
- lib/dm_cloud/media.rb
|
@@ -32,6 +146,13 @@ files:
|
|
32
146
|
- lib/dm_cloud/signing.rb
|
33
147
|
- lib/dm_cloud/streaming.rb
|
34
148
|
- lib/dm_cloud/version.rb
|
149
|
+
- spec/dm_cloud/media_spec.rb
|
150
|
+
- spec/dm_cloud/signing_spec.rb
|
151
|
+
- spec/dm_cloud/streaming_spec.rb
|
152
|
+
- spec/dm_cloud_spec.rb
|
153
|
+
- spec/spec_helper.rb
|
154
|
+
- spec/vcr_cassettes/dm_cloud/dm_cloud_streaming.yml
|
155
|
+
- spec/vcr_cassettes/dm_cloud_media.yml
|
35
156
|
homepage: ''
|
36
157
|
licenses: []
|
37
158
|
post_install_message:
|
@@ -44,6 +165,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
165
|
- - ! '>='
|
45
166
|
- !ruby/object:Gem::Version
|
46
167
|
version: '0'
|
168
|
+
segments:
|
169
|
+
- 0
|
170
|
+
hash: 4229416292724513702
|
47
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
172
|
none: false
|
49
173
|
requirements:
|
@@ -56,4 +180,11 @@ rubygems_version: 1.8.24
|
|
56
180
|
signing_key:
|
57
181
|
specification_version: 3
|
58
182
|
summary: Simplify DailyMotion Cloud API usage
|
59
|
-
test_files:
|
183
|
+
test_files:
|
184
|
+
- spec/dm_cloud/media_spec.rb
|
185
|
+
- spec/dm_cloud/signing_spec.rb
|
186
|
+
- spec/dm_cloud/streaming_spec.rb
|
187
|
+
- spec/dm_cloud_spec.rb
|
188
|
+
- spec/spec_helper.rb
|
189
|
+
- spec/vcr_cassettes/dm_cloud/dm_cloud_streaming.yml
|
190
|
+
- spec/vcr_cassettes/dm_cloud_media.yml
|
data/dm_cloud.gemspec
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'dm_cloud/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |gem|
|
7
|
-
gem.name = "dm_cloud"
|
8
|
-
gem.version = DMCloud::VERSION
|
9
|
-
gem.authors = ["Jeremy Mortelette"]
|
10
|
-
gem.email = ["mortelette.jeremy@gmail.com"]
|
11
|
-
gem.description = 'This gem will simplify usage of DailyMotion Cloud API, it represent api in ruby style, with automated handler for search and upload files'
|
12
|
-
gem.summary = 'Simplify DailyMotion Cloud API usage'
|
13
|
-
gem.homepage = ""
|
14
|
-
|
15
|
-
gem.files = `git ls-files`.split($/)
|
16
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
-
gem.require_paths = ["lib"]
|
19
|
-
end
|