eyeson 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +121 -0
- data/Rakefile +28 -0
- data/lib/eyeson.rb +27 -0
- data/lib/eyeson/account.rb +25 -0
- data/lib/eyeson/broadcast.rb +27 -0
- data/lib/eyeson/config.rb +11 -0
- data/lib/eyeson/file_upload.rb +35 -0
- data/lib/eyeson/layer.rb +26 -0
- data/lib/eyeson/message.rb +19 -0
- data/lib/eyeson/recording.rb +20 -0
- data/lib/eyeson/requests.rb +43 -0
- data/lib/eyeson/room.rb +26 -0
- data/lib/eyeson/version.rb +3 -0
- data/lib/eyeson/webhook.rb +14 -0
- data/lib/tasks/eyeson_tasks.rake +4 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: df038ff7b658f27c2f39ef01417c1001f7f87b46
|
4
|
+
data.tar.gz: 33a6f554c01e04eac6672ef6b491b0770ca070a9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6a4458e514f1bcb32c97e98fe174e2ee714c7dd5c8905250c9ec6127f5b48c71f57723db9b1c1b200b7825dcbf6393b0fb0b42ce7abcd4d248224a63dcc62101
|
7
|
+
data.tar.gz: 458f634872b4482aa2f7172a01a325a852a0b4126b368a96e36159eff9f084a7ff5c0e7ab536ba6b648e0387fdcdd27c798202c231f950b998da21eb58dfcb41
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 eyeson GmbH
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
# Eyeson
|
2
|
+
eyeson ruby sdk for service app implementation
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'eyeson'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
```bash
|
13
|
+
$ bundle install
|
14
|
+
```
|
15
|
+
|
16
|
+
## Configuration
|
17
|
+
```ruby
|
18
|
+
Eyeson.configure do |config|
|
19
|
+
config.api_key = 'YOUR_API_KEY'
|
20
|
+
config.api_endpoint = 'https://api.eyeson.team'
|
21
|
+
end
|
22
|
+
```
|
23
|
+
|
24
|
+
## Receive webhooks for specific events
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
Eyeson::Webhook.create!(
|
28
|
+
url, # Webhooks will be sent to this URL
|
29
|
+
types: [] # supported types: 'room', 'team', 'user', 'presentation', 'broadcast', 'file'
|
30
|
+
)
|
31
|
+
```
|
32
|
+
|
33
|
+
## Meeting reference
|
34
|
+
|
35
|
+
### Join a meeting room
|
36
|
+
|
37
|
+
Puts a user to a (specific) meeting room.
|
38
|
+
|
39
|
+
If no arbitrary ids are given, random ids will be generated.
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
room = Eyeson::Room.join(id: 'ARBITRARY_ID', # optional, e.g. to join a specific room
|
43
|
+
name: 'DISPLAY_NAME', # optional
|
44
|
+
user: {
|
45
|
+
id: 'ARBITRARY_ID', # optional, e.g. your internal user_id
|
46
|
+
name: 'DISPLAY_NAME', # required!
|
47
|
+
avatar: 'IMAGE_URL' # optional
|
48
|
+
})
|
49
|
+
```
|
50
|
+
|
51
|
+
The meeting room will be available immediately:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
# Temporary access key - only valid for current session:
|
55
|
+
# access_key = room.access_key
|
56
|
+
|
57
|
+
redirect_to room.url
|
58
|
+
```
|
59
|
+
|
60
|
+
### Upload a presentation file from remote URL
|
61
|
+
|
62
|
+
Uploads and converts any external stored PDF file for presentation.
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
Eyeson::FileUpload.new(access_key).upload_from('FILE_URL')
|
66
|
+
```
|
67
|
+
|
68
|
+
### Start a live broadcast (YouTube only at the moment)
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
Eyeson::Broadcast.new(access_key).create(
|
72
|
+
platform: 'youtube',
|
73
|
+
stream_url: 'YOUTUBE_STREAM_URL' # see YouTube documentation on how to get a stream url.
|
74
|
+
)
|
75
|
+
```
|
76
|
+
|
77
|
+
#### Stop specific broadcast
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
Eyeson::Broadcast.new(access_key).destroy(
|
81
|
+
platform: 'youtube'
|
82
|
+
)
|
83
|
+
```
|
84
|
+
|
85
|
+
#### Stop all broadcasts
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
Eyeson::Broadcast.new(access_key).destroy_all
|
89
|
+
```
|
90
|
+
|
91
|
+
### Send a message into meeting chat
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
Eyeson::Message.new(access_key).create(
|
95
|
+
type: 'chat',
|
96
|
+
content: 'YOUR_MESSAGE'
|
97
|
+
)
|
98
|
+
```
|
99
|
+
|
100
|
+
### Insert an image into video
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
Eyeson::Layer.new(access_key).create(
|
104
|
+
file: FILE, # either file or url must be provided!
|
105
|
+
url: URL, # either file or url must be provided!
|
106
|
+
index: 1, # (optional) use 1 (default) to set as foreground image and -1 to set as background image
|
107
|
+
layout: nil # (optional) currently supported: 'auto' (meeting participants will be arranged automatically), 'fixed' (meeting participants will be rendered at the bottom of the video, so your background content can be fully displayed.)
|
108
|
+
)
|
109
|
+
```
|
110
|
+
|
111
|
+
### Get download URL of a specific recording
|
112
|
+
|
113
|
+
It is assumed that the recording_id is known (e.g. from a webhook request).
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
recording = Eyeson::Recording.find(recording_id)
|
117
|
+
redirect_to recording.url
|
118
|
+
```
|
119
|
+
|
120
|
+
## License
|
121
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
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 = 'Eyeson'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'bundler/gem_tasks'
|
18
|
+
|
19
|
+
require 'rake/testtask'
|
20
|
+
|
21
|
+
Rake::TestTask.new(:test) do |t|
|
22
|
+
t.libs << 'lib'
|
23
|
+
t.libs << 'test'
|
24
|
+
t.pattern = 'test/**/*_test.rb'
|
25
|
+
t.verbose = false
|
26
|
+
end
|
27
|
+
|
28
|
+
task default: :test
|
data/lib/eyeson.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Eyeson API
|
2
|
+
module Eyeson
|
3
|
+
require 'rest_client'
|
4
|
+
|
5
|
+
class << self
|
6
|
+
attr_writer :configuration
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.configuration
|
10
|
+
@configuration ||= Configuration.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.configure
|
14
|
+
yield(configuration)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
require_relative 'eyeson/config'
|
19
|
+
require_relative 'eyeson/requests'
|
20
|
+
require_relative 'eyeson/account'
|
21
|
+
require_relative 'eyeson/webhook'
|
22
|
+
require_relative 'eyeson/room'
|
23
|
+
require_relative 'eyeson/file_upload'
|
24
|
+
require_relative 'eyeson/layer'
|
25
|
+
require_relative 'eyeson/broadcast'
|
26
|
+
require_relative 'eyeson/message'
|
27
|
+
require_relative 'eyeson/recording'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Eyeson
|
2
|
+
# Handles eyeson account confirmation
|
3
|
+
class Account
|
4
|
+
class ValidationFailed < StandardError
|
5
|
+
end
|
6
|
+
|
7
|
+
attr_reader :confirmation_url
|
8
|
+
|
9
|
+
def initialize(confirmation_url: nil)
|
10
|
+
@confirmation_url = confirmation_url
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.find_or_initialize_by(user: {}, remote_ip: nil)
|
14
|
+
confirmed = Eyeson.post('/internal/accounts',
|
15
|
+
user: user,
|
16
|
+
remote_ip: remote_ip)
|
17
|
+
confirmation_url = confirmed['create_url'] if confirmed.present?
|
18
|
+
Account.new(confirmation_url: confirmation_url)
|
19
|
+
end
|
20
|
+
|
21
|
+
def new_record?
|
22
|
+
@confirmation_url.present?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Eyeson
|
2
|
+
# Manages room broadcast
|
3
|
+
class Broadcast
|
4
|
+
class ValidationFailed < StandardError
|
5
|
+
end
|
6
|
+
|
7
|
+
def initialize(access_key)
|
8
|
+
@access_key = access_key
|
9
|
+
end
|
10
|
+
|
11
|
+
def create(platform: nil, stream_url: nil)
|
12
|
+
response = Eyeson.post("/rooms/#{@access_key}/broadcasts",
|
13
|
+
platform: platform,
|
14
|
+
stream_url: stream_url)
|
15
|
+
|
16
|
+
raise ValidationFailed, response['error'] if response['error'].present?
|
17
|
+
end
|
18
|
+
|
19
|
+
def destroy(platform: nil)
|
20
|
+
Eyeson.delete("/rooms/#{@access_key}/broadcasts/#{platform}")
|
21
|
+
end
|
22
|
+
|
23
|
+
def destroy_all
|
24
|
+
Eyeson.delete("/rooms/#{@access_key}/broadcasts")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
module Eyeson
|
4
|
+
# Manages file uploads
|
5
|
+
class FileUpload
|
6
|
+
class ValidationFailed < StandardError
|
7
|
+
end
|
8
|
+
|
9
|
+
attr_accessor :file
|
10
|
+
|
11
|
+
def initialize(access_key)
|
12
|
+
@access_key = access_key
|
13
|
+
@file = nil
|
14
|
+
end
|
15
|
+
|
16
|
+
def upload_from(url)
|
17
|
+
Tempfile.class_eval do
|
18
|
+
attr_accessor :original_filename
|
19
|
+
end
|
20
|
+
|
21
|
+
url = URI(url)
|
22
|
+
@file = OpenURI.open_uri url
|
23
|
+
@file.original_filename = File.basename url.path
|
24
|
+
|
25
|
+
upload!
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def upload!
|
31
|
+
response = Eyeson.post("/rooms/#{@access_key}/files", file: @file)
|
32
|
+
raise ValidationFailed, response['error'] if response['error'].present?
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/eyeson/layer.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Eyeson
|
2
|
+
# Manages room layers
|
3
|
+
class Layer
|
4
|
+
class ValidationFailed < StandardError
|
5
|
+
end
|
6
|
+
|
7
|
+
def initialize(access_key)
|
8
|
+
@access_key = access_key
|
9
|
+
end
|
10
|
+
|
11
|
+
def create(file: nil, url: nil, insert: nil, index: 1, layout: nil)
|
12
|
+
response = Eyeson.post("/rooms/#{@access_key}/layers",
|
13
|
+
file: file,
|
14
|
+
url: url,
|
15
|
+
insert: insert,
|
16
|
+
'z-index' => index,
|
17
|
+
layout: layout)
|
18
|
+
|
19
|
+
raise ValidationFailed, response['error'] if response['error'].present?
|
20
|
+
end
|
21
|
+
|
22
|
+
def destroy(index: 1, layout: nil)
|
23
|
+
Eyeson.delete("/rooms/#{@access_key}/layers/#{index}", layout: layout)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Eyeson
|
2
|
+
# Forward messages to room
|
3
|
+
class Message
|
4
|
+
class ValidationFailed < StandardError
|
5
|
+
end
|
6
|
+
|
7
|
+
def initialize(access_key)
|
8
|
+
@access_key = access_key
|
9
|
+
end
|
10
|
+
|
11
|
+
def create(type: nil, content: nil)
|
12
|
+
response = Eyeson.post("/rooms/#{@access_key}/messages",
|
13
|
+
type: type,
|
14
|
+
content: content)
|
15
|
+
|
16
|
+
raise ValidationFailed, response['error'] if response['error'].present?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Eyeson
|
2
|
+
# Get room recordings
|
3
|
+
class Recording
|
4
|
+
class NotFound < StandardError
|
5
|
+
end
|
6
|
+
|
7
|
+
attr_reader :url
|
8
|
+
|
9
|
+
def initialize(url)
|
10
|
+
@url = url
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.find(recording_id)
|
14
|
+
response = Eyeson.get("/recordings/#{recording_id}")
|
15
|
+
links = response['links']
|
16
|
+
raise NotFound if links.nil?
|
17
|
+
Recording.new(links['download'])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Provides REST methods
|
2
|
+
module Eyeson
|
3
|
+
def get(path, params = {})
|
4
|
+
request(:get, path, params)
|
5
|
+
end
|
6
|
+
module_function :get
|
7
|
+
|
8
|
+
def post(path, params = {})
|
9
|
+
request(:post, path, params)
|
10
|
+
end
|
11
|
+
module_function :post
|
12
|
+
|
13
|
+
def delete(path, params = {})
|
14
|
+
request(:delete, path, params)
|
15
|
+
end
|
16
|
+
module_function :delete
|
17
|
+
|
18
|
+
def request(method, path, params)
|
19
|
+
req = RestClient::Request.new(
|
20
|
+
method: method,
|
21
|
+
url: configuration.api_endpoint + path,
|
22
|
+
payload: params.compact,
|
23
|
+
headers: {
|
24
|
+
authorization: configuration.api_key,
|
25
|
+
accept: 'application/json',
|
26
|
+
user_agent: 'eyeson-ruby'
|
27
|
+
}
|
28
|
+
)
|
29
|
+
response_for(req)
|
30
|
+
end
|
31
|
+
module_function :request
|
32
|
+
|
33
|
+
def response_for(req)
|
34
|
+
res = begin
|
35
|
+
req.execute
|
36
|
+
rescue RestClient::ExceptionWithResponse => e
|
37
|
+
e.response
|
38
|
+
end
|
39
|
+
return {} if res.body.empty?
|
40
|
+
JSON.parse(res.body)
|
41
|
+
end
|
42
|
+
module_function :response_for
|
43
|
+
end
|
data/lib/eyeson/room.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Eyeson
|
2
|
+
# Manages conf rooms
|
3
|
+
class Room
|
4
|
+
class ValidationFailed < StandardError
|
5
|
+
end
|
6
|
+
|
7
|
+
attr_reader :url, :access_key, :links
|
8
|
+
|
9
|
+
def initialize(response = {})
|
10
|
+
@url = response['links']['gui']
|
11
|
+
@access_key = response['access_key']
|
12
|
+
@links = response['links']
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.join(id: nil, name: nil, user: {}, options: nil)
|
16
|
+
response = Eyeson.post('/rooms',
|
17
|
+
id: id,
|
18
|
+
name: name,
|
19
|
+
user: user,
|
20
|
+
options: options)
|
21
|
+
|
22
|
+
raise ValidationFailed, response['error'] if response['error'].present?
|
23
|
+
Room.new(response)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Eyeson
|
2
|
+
# Creates Webhooks
|
3
|
+
class Webhook
|
4
|
+
class ValidationFailed < StandardError
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.create!(url: nil, types: [])
|
8
|
+
response = Eyeson.post('/webhooks',
|
9
|
+
url: url,
|
10
|
+
types: types.join(','))
|
11
|
+
raise ValidationFailed, response['error'] if response['error'].present?
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eyeson
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.4.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Maier
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-04-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.2
|
41
|
+
description: Use the eyeson api to boost your app with video conferencing
|
42
|
+
email:
|
43
|
+
- developers@eyeson.team
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- MIT-LICENSE
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- lib/eyeson.rb
|
52
|
+
- lib/eyeson/account.rb
|
53
|
+
- lib/eyeson/broadcast.rb
|
54
|
+
- lib/eyeson/config.rb
|
55
|
+
- lib/eyeson/file_upload.rb
|
56
|
+
- lib/eyeson/layer.rb
|
57
|
+
- lib/eyeson/message.rb
|
58
|
+
- lib/eyeson/recording.rb
|
59
|
+
- lib/eyeson/requests.rb
|
60
|
+
- lib/eyeson/room.rb
|
61
|
+
- lib/eyeson/version.rb
|
62
|
+
- lib/eyeson/webhook.rb
|
63
|
+
- lib/tasks/eyeson_tasks.rake
|
64
|
+
homepage: https://www.eyeson.team/developers
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 2.6.14.1
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: eyeson API
|
88
|
+
test_files: []
|