dm_cloud 0.1.2 → 0.2.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
data/dm_cloud.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "dm_cloud"
8
- s.version = "0.1.2"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeremy Mortelette"]
@@ -11,7 +11,7 @@ module DmCloud
11
11
  DIRECT_STREAM = "[PROTOCOL]://cdn.dmcloud.net/route/[USER_ID]/[MEDIA_ID]/[ASSET_NAME].[ASSET_EXTENSION]".freeze
12
12
  EMBED_STREAM = "[PROTOCOL]://api.dmcloud.net/embed/[USER_ID]/[MEDIA_ID]".freeze
13
13
  EMBED_IFRAME = '<iframe width="[WIDTH]" height="[HEIGHT]" frameborder="0" scrolling="no" src="[EMBED_URL]"></iframe>'.freeze
14
-
14
+
15
15
  # Get embeded player
16
16
  # Params :
17
17
  # media_id: this is the id of the media (eg: 4c922386dede830447000009)
@@ -22,7 +22,7 @@ module DmCloud
22
22
  # Result :
23
23
  # return a string which contain the signed url like
24
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>
25
- def self.embed(media_id, options = {})
25
+ def self.embed(media_id, options = {}, security = {})
26
26
  raise StandardError, "missing :media_id in params" unless media_id
27
27
 
28
28
  skin_id = options[:skin_id] ? options[:skin_id] : 'modern1'
@@ -33,7 +33,7 @@ module DmCloud
33
33
  stream.gsub!('[PROTOCOL]', DmCloud.config[:protocol])
34
34
  stream.gsub!('[USER_ID]', DmCloud.config[:user_key])
35
35
  stream.gsub!('[MEDIA_ID]', media_id)
36
- signed_url = DmCloud::Signing.sign(stream)
36
+ signed_url = DmCloud::Signing.sign(stream, security)
37
37
  signed_url = stream + "?auth=#{signed_url}"
38
38
 
39
39
  frame = EMBED_IFRAME.dup
@@ -52,7 +52,7 @@ module DmCloud
52
52
  # Result :
53
53
  # return a string which contain the signed url like
54
54
  # http://cdn.DmCloud.net/route/<user_id>/<media_id>/<asset_name>.<asset_extension>?auth=<auth_token>
55
- def self.url(media_id, asset_name, asset_extension = nil)
55
+ def self.url(media_id, asset_name, asset_extension = nil, security = {})
56
56
  raise StandardError, "missing :media_id in params" unless media_id
57
57
  raise StandardError, "missing :asset_name in params" unless asset_name
58
58
  asset_extension = asset_name.split('_').first unless asset_extension
@@ -64,7 +64,7 @@ module DmCloud
64
64
  stream.gsub!('[ASSET_NAME]', asset_name)
65
65
  stream.gsub!('[ASSET_EXTENSION]', asset_extension)
66
66
 
67
- stream += '?auth=[AUTH_TOKEN]'.gsub!('[AUTH_TOKEN]', DmCloud::Signing.sign(stream))
67
+ stream += '?auth=[AUTH_TOKEN]'.gsub!('[AUTH_TOKEN]', DmCloud::Signing.sign(stream, security))
68
68
  stream
69
69
  end
70
70
  end
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.1.2
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -168,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  segments:
170
170
  - 0
171
- hash: 70467423529784663
171
+ hash: -947249621362066438
172
172
  required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  none: false
174
174
  requirements: