vdocipher 0.0.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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/vdocipher.rb +39 -0
  3. metadata +44 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1203eb8bc51e66fbfd3d6e039c4472012bf59c6d
4
+ data.tar.gz: 80914e7e0b4a0b0e9b5d322adae659f7f14c7dd6
5
+ SHA512:
6
+ metadata.gz: 30819ef03e008bc1d1cc9bb34e6a503d8307e20cff4d6389f216d20e993aa094081f807954d7a2da4f815250a94ad0a014c51904cf62f81ef26344b1b8b8d4a2
7
+ data.tar.gz: c9d42e5dc65a89ec1ade356f2a87500a8a3657e251d04e3265a79e7d8e2e543928e8f9ef20db02bcbe8bc8d9cd604757b3d36a29af3aeeda59a73f39c9ae3649
@@ -0,0 +1,39 @@
1
+ require "net/http"
2
+ require "json"
3
+ class VdoCipher
4
+ def initialize(conf)
5
+ @key = conf[:clientSecretKey]
6
+ end
7
+ def play_code(id)
8
+ if (@key == nil)
9
+ return "key not set"
10
+ end
11
+ url = URI.parse('https://api.vdocipher.com/v2/otp?video='+ id)
12
+ req = Net::HTTP::Post.new(url.to_s)
13
+ req.body = 'clientSecretKey=' + @key
14
+ res = Net::HTTP.start(url.host, url.port, use_ssl:true) {|http|
15
+ http.request(req)
16
+ }
17
+ if(res.code != "200")
18
+ return res.code
19
+ end
20
+ otp = JSON.parse(res.body)
21
+ if( otp['error'] == "No video found" )
22
+ return "video not found"
23
+ end
24
+ embedcode = <<EOS
25
+ <div id="vdo%s" style="height:400px;width:640px;max-width:100%%;"></div>
26
+ <script>
27
+ (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);};
28
+ if(!v[o].l) { v[o].l=1*new Date(); a=i.createElement(d), m=i.getElementsByTagName(d)[0];
29
+ a.async=1; a.src=e; m.parentNode.insertBefore(a,m);}
30
+ })(window,document,"script","//de122v0opjemw.cloudfront.net/vdo.js","vdo");
31
+ vdo.add({o: "%s"});
32
+ </script>
33
+ EOS
34
+ embedcode = embedcode % [otp["otp"] , otp["otp"]]
35
+ end
36
+ end
37
+
38
+ v = VdoCipher.new(clientSecretKey: "3de94fa6f3b28f2e89c3dd3be9bc92cca455202f77cb7abcb3e64c74837ab595");
39
+ puts v.play_code("8d66dc155a2aaf341394c8691f21f117");
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vdocipher
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Vibhav Sinha
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-10 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Stream and manage videos hosted through vdocipher streaming service.
14
+ email: info@vdocipher.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/vdocipher.rb
20
+ homepage: http://www.vdocipher.com/api.ror
21
+ licenses:
22
+ - GPL
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.2.2
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: VdoCipher API interface
44
+ test_files: []