vidyo_io 1.0.0 → 1.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73f98ae9c4659f88ccf4e201dbf59a1bf359bd52
4
- data.tar.gz: 11c82fd2b48fa4fc43940ec0968c07748981850c
3
+ metadata.gz: 51035f4371e6703dce63342784f2d8799443725a
4
+ data.tar.gz: 0a02d5192ed3422bc5b7466c4d1c4f2ae1f5953b
5
5
  SHA512:
6
- metadata.gz: dfcccee7b4158574577985aeb36c37c6fcb90473231ce22a0ea89a4e50adfd6eae47de0b53de959e88c050e38bdddcb02066b284dc02054da078c02dfd510172
7
- data.tar.gz: 0971e2525b11dbda56c0d15252453518da01dba02cc86175a13491bf64c0e4f43326a3cf85a5071f79df31d30ba47d113bd8c168edb548723ccbd777d099b4c8
6
+ metadata.gz: b50da11087abcd7bc612d67ba94096e3a39185b63bcd56a524f9ecb1e29dccaa22b9abd801c263b7965b4f06488eaef64c877bc122bdd4fc3e2b56c8db95f1b8
7
+ data.tar.gz: 15205db3911b1e2dcb21a87f0e107522777787d3f8f2b672ba45300ec4fb65ac114ca3ed82e01842075f7efeadf6b59c91beefe4c327dbcfd811403851d761e2
@@ -0,0 +1,21 @@
1
+ [![Build Status](https://travis-ci.org/Babylonpartners/vidyo_io.svg?branch=master)](https://travis-ci.org/Babylonpartners/vidyo_io)[![Coverage Status](https://coveralls.io/repos/github/Babylonpartners/vidyo_io/badge.svg?branch=master)](https://coveralls.io/github/Babylonpartners/vidyo_io?branch=master)
2
+
3
+ # VidyoIo API Implementation in Ruby
4
+
5
+ ## Installation
6
+ ```ruby
7
+ gem 'vidyo_io', '~> 1.0'
8
+ ```
9
+
10
+ ## Usage
11
+
12
+ ### Get video call token
13
+
14
+ ```ruby
15
+ require 'vidyo_io'
16
+
17
+ VidyoIo::Configuration.application_id = ENV.fetch('VIDYO_APPLICATION_ID') # Change for your details
18
+ VidyoIo::Configuration.developer_key = ENV.fetch('VIDYO_DEVELOPER_KEY')
19
+
20
+ VidyoIo::Util::Token.generate(ttl: 3600, username: 'user_1') # ttl (Time to live) and username are optional params
21
+ ```
@@ -0,0 +1,3 @@
1
+ require 'vidyo_io/configuration'
2
+ require 'vidyo_io/util/binascii'
3
+ require 'vidyo_io/util/token'
@@ -0,0 +1,11 @@
1
+ require 'singleton'
2
+
3
+ module VidyoIo
4
+ class Configuration
5
+ include Singleton
6
+
7
+ class << self
8
+ attr_accessor :application_id, :developer_key
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ module VidyoIo
2
+ module Util
3
+ # A Ruby implementation of part of Python's binascii module
4
+ module BinASCII
5
+ # Convert the supplied binary string to the hex representation
6
+ #
7
+ # @param [String] bin_data The binary data to encode
8
+ # @return [String] The hex encoded binary data.
9
+ def self.hexlify(bin_data)
10
+ bin_data.unpack('H*').first
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,24 @@
1
+ require 'base64'
2
+
3
+ module VidyoIo
4
+ module Util
5
+ class Token
6
+ EPOCH_SECONDS = 62_167_219_200
7
+
8
+ # Creates a token to start a video call
9
+ #
10
+ # @param [String] username Username to connec to the call
11
+ # @param [Integer] ttl 'Time to live' indicates how long the token will be valid for
12
+ # @return [String] A valid token to start a video call
13
+ def self.generate(username: 'user1', ttl: 3600)
14
+ jid = "#{username}@#{Configuration.application_id}\0"
15
+ timestamp = Time.now.to_i + ttl + EPOCH_SECONDS
16
+ type = "provision\0"
17
+ body = "#{type}#{jid}#{timestamp}\0"
18
+ mac = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha384'), Configuration.developer_key, body)
19
+ mac = BinASCII.hexlify(mac)
20
+ Base64.strict_encode64("#{body}\0#{mac}".encode('utf-8'))
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,5 @@
1
+ module VidyoIo
2
+ module Version
3
+ String = "1.0.1"
4
+ end
5
+ end
@@ -1,6 +1,8 @@
1
1
  $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
2
2
  require 'timecop'
3
3
  require 'vidyo_io'
4
+ require 'coveralls'
5
+ Coveralls.wear!
4
6
 
5
7
  VidyoIo::Configuration.application_id = "integration_application_id"
6
8
  VidyoIo::Configuration.developer_key = "integration_developer_key"
@@ -14,6 +14,6 @@ Gem::Specification.new do |s|
14
14
  s.description = "Ruby library for integrating with VidyoIO API"
15
15
  s.license = "MIT"
16
16
 
17
- s.files = Dir["MIT-LICENSE", "Rakefile", "README.rdoc", "*.gemspec"]
18
- s.test_files = Dir["spec/**/*"]
17
+ s.files = Dir['lib/**/*', 'MIT-LICENSE', 'README.md', '*.gemspec']
18
+ s.test_files = Dir['spec/**/*']
19
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vidyo_io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Cámara
@@ -18,7 +18,12 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - MIT-LICENSE
21
- - Rakefile
21
+ - README.md
22
+ - lib/vidyo_io.rb
23
+ - lib/vidyo_io/configuration.rb
24
+ - lib/vidyo_io/util/binascii.rb
25
+ - lib/vidyo_io/util/token.rb
26
+ - lib/vidyo_io/version.rb
22
27
  - spec/lib/vidyo_io/configuration_spec.rb
23
28
  - spec/lib/vidyo_io/util/binascii_spec.rb
24
29
  - spec/lib/vidyo_io/util/token_spec.rb
data/Rakefile DELETED
@@ -1,34 +0,0 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'VidyoIo'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
-
18
-
19
-
20
-
21
-
22
- Bundler::GemHelper.install_tasks
23
-
24
- require 'rake/testtask'
25
-
26
- Rake::TestTask.new(:test) do |t|
27
- t.libs << 'lib'
28
- t.libs << 'test'
29
- t.pattern = 'test/**/*_test.rb'
30
- t.verbose = false
31
- end
32
-
33
-
34
- task default: :test