vdocipher 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vdocipher.rb +28 -24
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efbe0acc8a10fdb58e5ea7973ee8af5ae71c2b13
|
4
|
+
data.tar.gz: 43fd5d2ffadf64c07fe353d3c303c29314268b34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d24b529d8e152b4a67843de0e5b687b4ea5230c8fde94a3a32ed97c9416c7cb1064fee36fd8530f0898cb41fc20f289813e2d6918f7b66cb4686f8549dbe2580
|
7
|
+
data.tar.gz: 3aa37be3d2de3571f342e7526b800023e8b4c97b49a00d908f08781cd67c2e1d55cea5a989f8d5201f5d66bfaea27ed8556a30592c9f7ff3a7dda511ebcad0e5
|
data/lib/vdocipher.rb
CHANGED
@@ -1,34 +1,38 @@
|
|
1
1
|
require "net/http"
|
2
2
|
require "json"
|
3
3
|
class VdoCipher
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
4
|
+
@@version = '1.1.0'
|
5
|
+
attr_reader :version
|
6
|
+
|
7
|
+
def initialize(conf, version = '1.1.3')
|
8
|
+
@key = conf[:clientSecretKey]
|
9
|
+
@version = version
|
10
|
+
end
|
11
|
+
def play_code(id, attr="", theme="9ae8bbe8dd964ddc9bdb932cca1cb59a")
|
12
|
+
if (@key == nil)
|
13
|
+
return "key not set"
|
14
|
+
end
|
15
|
+
url = URI.parse('https://api.vdocipher.com/v2/otp?video='+ id)
|
16
|
+
req = Net::HTTP::Post.new(url.to_s)
|
17
|
+
req.body = 'clientSecretKey=' + @key
|
18
|
+
res = Net::HTTP.start(url.host, url.port, use_ssl:true) {|http|
|
19
|
+
http.request(req)
|
20
|
+
}
|
21
|
+
if(res.code != "200")
|
22
|
+
return 'Status code error: ' + res.code
|
23
|
+
end
|
24
|
+
otp = JSON.parse(res.body)
|
25
|
+
if( otp['error'] == "No video found" )
|
26
|
+
return "video not found"
|
27
|
+
end
|
24
28
|
# make the theme configurable
|
25
|
-
|
29
|
+
embedcode = <<EOS
|
26
30
|
<div id="vdo%s" %s></div>
|
27
31
|
<script>
|
28
32
|
(function(v,i,d,e,o){v[o]=v[o]||{}; v[o].add = v[o].add || function V(a){ (v[o].d=v[o].d||[]).push(a);};
|
29
33
|
if(!v[o].l) { v[o].l=1*new Date(); a=i.createElement(d), m=i.getElementsByTagName(d)[0];
|
30
34
|
a.async=1; a.src=e; m.parentNode.insertBefore(a,m);}
|
31
|
-
})(window,document,"script","https://d1z78r8i505acl.cloudfront.net/playerAssets/vdo.js","vdo");
|
35
|
+
})(window,document,"script","https://d1z78r8i505acl.cloudfront.net/playerAssets/%s/vdo.js","vdo");
|
32
36
|
vdo.add({
|
33
37
|
otp: "%s",
|
34
38
|
playbackInfo: btoa(JSON.stringify({
|
@@ -40,7 +44,7 @@ vdo.add({
|
|
40
44
|
</script>
|
41
45
|
|
42
46
|
EOS
|
43
|
-
|
44
|
-
|
47
|
+
embedcode = embedcode % [otp["otp"], attr, version, otp["otp"], id, theme, otp["otp"]]
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vdocipher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vibhav Sinha
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Stream and manage videos hosted through vdocipher streaming service.
|
14
14
|
email: info@vdocipher.com
|