streamapi 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/streamapi/client.rb +15 -17
- data/lib/streamapi/version.rb +1 -1
- data/lib/streamapi.rb +1 -1
- metadata +3 -3
data/lib/streamapi/client.rb
CHANGED
@@ -26,17 +26,17 @@ module StreamAPI
|
|
26
26
|
attr_accessor :api_key, :secret_key, :site_id, :site_user_id, :username, :timeout, :debug
|
27
27
|
|
28
28
|
def initialize(options={})
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
raise(InvalidApiKeyError, "Missing api_key!") if options[:api_key].nil?
|
30
|
+
raise(InvalidSecretKeyError, "Missing secret_key!") if options[:secret_key].nil?
|
31
|
+
raise(InvalidSiteIdError, "Missing site_id!") if options[:site_id].nil?
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
@api_key = options[:api_key]
|
34
|
+
@@api_key = @api_key
|
35
|
+
@secret_key = options[:secret_key]
|
36
|
+
@site_id = options[:site_id]
|
37
|
+
@username = options[:username] if options.has_key?('username')
|
38
38
|
|
39
|
-
|
39
|
+
return self
|
40
40
|
end
|
41
41
|
|
42
42
|
def get_public_host_id(private_host_id = nil, site_user_id = nil)
|
@@ -49,12 +49,12 @@ module StreamAPI
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def create_session(username = nil, fme_key = nil, is_video_private = nil, public_host_id = nil, site_user_id = nil)
|
52
|
-
|
52
|
+
response = self.class.post("/session/create", :query=>preprocess_options({:username=>username,
|
53
53
|
:is_video_private=>is_video_private, :public_host_id=>public_host_id, :site_user_id=>site_user_id}))
|
54
54
|
end
|
55
55
|
|
56
56
|
def create_user(username)
|
57
|
-
|
57
|
+
response = self.class.post("/session/create", :query => preprocess_options({:username => username}))
|
58
58
|
end
|
59
59
|
|
60
60
|
def get_live_session_status(public_host_id)
|
@@ -70,13 +70,11 @@ module StreamAPI
|
|
70
70
|
def list_themes()
|
71
71
|
themes = []
|
72
72
|
response = self.class.get("/theme/list", :query => preprocess_options)
|
73
|
-
# iterate themes
|
74
73
|
end
|
75
74
|
|
76
75
|
def list_live_sessions()
|
77
|
-
|
78
|
-
|
79
|
-
# iterate results
|
76
|
+
live_sessions = []
|
77
|
+
response = self.class.get("/session/live/list", :query => preprocess_options)
|
80
78
|
end
|
81
79
|
|
82
80
|
def preprocess_options(options=nil)
|
@@ -91,8 +89,8 @@ module StreamAPI
|
|
91
89
|
end
|
92
90
|
|
93
91
|
def self.sign(options,secret,rid)
|
94
|
-
|
95
|
-
|
92
|
+
options.delete_if{ options.has_key?('sig') }
|
93
|
+
Digest::MD5.hexdigest(options.sort().collect{|v| v[1]}.join+secret+rid.to_s)
|
96
94
|
end
|
97
95
|
end
|
98
96
|
end
|
data/lib/streamapi/version.rb
CHANGED
data/lib/streamapi.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Panagiotis Papadoulos
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-05 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|