Class: UCEngine::Client::Session
- Inherits:
-
Struct
- Object
- Struct
- UCEngine::Client::Session
- Includes:
- NetHttpRequest, NetHttpResponse
- Defined in:
- lib/em-ucengine/client.rb,
lib/em-ucengine/client_nethttp.rb
Overview
Session represent the U.C.Engine client with and sid and uid See #connect
Direct Known Subclasses
Instance Attribute Summary collapse
-
#sid ⇒ Object
Returns the value of attribute sid.
-
#uce ⇒ Object
Returns the value of attribute uce.
-
#uid ⇒ Object
Returns the value of attribute uid.
Instance Method Summary collapse
-
#create_meeting(meeting, body = {}, &block) ⇒ Object
Create a meeting.
-
#create_role(data, &block) ⇒ Object
Create a role.
-
#create_user(data, &block) ⇒ Object
Create user.
-
#delete_file(meeting, filename, &block) ⇒ Object
Delete a file.
-
#delete_role(name, &block) ⇒ Object
Delete a role.
-
#delete_user(uid, &block) ⇒ Object
Delete a user.
-
#disconnect(sid, &block) ⇒ Object
Disconnect a user.
-
#event(id, &block) ⇒ Object
Get event.
-
#events(meeting = nil, params = {}, &block) ⇒ Object
Get events.
-
#files(meeting, params = {}, &block) ⇒ Object
List files on a meeting room.
-
#join_roster(meeting, body = {}, &block) ⇒ Object
Join the meeting.
-
#meeting(meeting, &block) ⇒ Object
Get meeting.
-
#meetings(&block) ⇒ Object
List meetings.
-
#presence(sid, &block) ⇒ Object
Get infos on the presence.
-
#publish(type, meeting = nil, metadata = nil, parent = nil, &block) ⇒ Object
Publish event.
-
#quit_roster(meeting, uid = nil, &block) ⇒ Object
Quit the meeting.
-
#roster(meeting, &block) ⇒ Object
List users on the meeting.
-
#search(params, &block) ⇒ Object
Search.
-
#time(&block) ⇒ Object
Get server time.
-
#update_meeting(meeting, body = {}, &block) ⇒ Object
Update a meeting.
-
#update_user(uid, data, &block) ⇒ Object
Update user.
- #url(*args) ⇒ Object
-
#user(uid, &block) ⇒ Object
Get user info.
-
#user_can(uid, action, object, conditions = {}, location = "", &block) ⇒ Object
Check user ACL.
-
#user_role(uid, params = {}, &block) ⇒ Object
Set a role to a user.
-
#users(&block) ⇒ Object
List users.
Methods included from NetHttpRequest
#delete, #get, #json_post, #post
Methods included from NetHttpResponse
#answer, #answer_bool, #answer_connect
Instance Attribute Details
#sid ⇒ Object
Returns the value of attribute sid
56 57 58 |
# File 'lib/em-ucengine/client.rb', line 56 def sid @sid end |
#uce ⇒ Object
Returns the value of attribute uce
56 57 58 |
# File 'lib/em-ucengine/client.rb', line 56 def uce @uce end |
#uid ⇒ Object
Returns the value of attribute uid
56 57 58 |
# File 'lib/em-ucengine/client.rb', line 56 def uid @uid end |
Instance Method Details
#create_meeting(meeting, body = {}, &block) ⇒ Object
Create a meeting
150 151 152 153 |
# File 'lib/em-ucengine/client.rb', line 150 def create_meeting(meeting, body={}, &block) body.merge!(:name => meeting) answer post(url("/meeting/"), body), &block end |
#create_role(data, &block) ⇒ Object
Create a role
247 248 249 |
# File 'lib/em-ucengine/client.rb', line 247 def create_role(data, &block) answer post(url("/role/"), data), &block end |
#create_user(data, &block) ⇒ Object
Create user
101 102 103 |
# File 'lib/em-ucengine/client.rb', line 101 def create_user(data, &block) answer post(url("/user"), data), &block end |
#delete_file(meeting, filename, &block) ⇒ Object
Delete a file
230 231 232 |
# File 'lib/em-ucengine/client.rb', line 230 def delete_file(meeting, filename, &block) answer delete(url("/file/#{meeting}/#{filename}")), &block end |
#delete_role(name, &block) ⇒ Object
Delete a role
254 255 256 |
# File 'lib/em-ucengine/client.rb', line 254 def delete_role(name, &block) answer delete(url "/role/#{name}"), &block end |
#delete_user(uid, &block) ⇒ Object
Delete a user
116 117 118 |
# File 'lib/em-ucengine/client.rb', line 116 def delete_user(uid, &block) answer delete(url("/user/#{uid}")), &block end |
#disconnect(sid, &block) ⇒ Object
Disconnect a user
80 81 82 |
# File 'lib/em-ucengine/client.rb', line 80 def disconnect(sid, &block) answer delete(url "/presence/#{sid}"), &block end |
#event(id, &block) ⇒ Object
Get event
212 213 214 215 |
# File 'lib/em-ucengine/client.rb', line 212 def event(id, &block) # Fixme: remove meeting fake param on the 0.7 release answer get(url("/event/meeting/#{id}"), {}), &block end |
#events(meeting = nil, params = {}, &block) ⇒ Object
Get events
193 194 195 |
# File 'lib/em-ucengine/client.rb', line 193 def events(meeting=nil, params={}, &block) answer get(url("/event/#{meeting}"), params), &block end |
#files(meeting, params = {}, &block) ⇒ Object
List files on a meeting room
238 239 240 |
# File 'lib/em-ucengine/client.rb', line 238 def files(meeting, params={}, &block) answer get(url("/file/#{meeting}"), params), &block end |
#join_roster(meeting, body = {}, &block) ⇒ Object
Join the meeting
175 176 177 |
# File 'lib/em-ucengine/client.rb', line 175 def join_roster(meeting, body={}, &block) answer post(url "/meeting/#{meeting}/roster", body), &block end |
#meeting(meeting, &block) ⇒ Object
Get meeting
142 143 144 |
# File 'lib/em-ucengine/client.rb', line 142 def meeting(meeting, &block) answer get(url "/meeting/#{meeting}"), &block end |
#meetings(&block) ⇒ Object
List meetings
135 136 137 |
# File 'lib/em-ucengine/client.rb', line 135 def meetings(&block) answer get(url "/meeting/"), &block end |
#presence(sid, &block) ⇒ Object
Get infos on the presence
73 74 75 |
# File 'lib/em-ucengine/client.rb', line 73 def presence(sid, &block) answer get(url("/presence/#{sid}")), &block end |
#publish(type, meeting = nil, metadata = nil, parent = nil, &block) ⇒ Object
Publish event
202 203 204 205 206 207 |
# File 'lib/em-ucengine/client.rb', line 202 def publish(type, meeting=nil, =nil, parent=nil, &block) args = { :type => type, :uid => uid, :sid => sid } args[:parent] = parent if parent args[:metadata] = if answer json_post(url("/event/#{meeting}"), args), &block end |
#quit_roster(meeting, uid = nil, &block) ⇒ Object
Quit the meeting
183 184 185 |
# File 'lib/em-ucengine/client.rb', line 183 def quit_roster(meeting, uid=nil, &block) answer delete(url "/meeting/#{meeting}/roster/#{uid || @uid}"), &block end |
#roster(meeting, &block) ⇒ Object
List users on the meeting
168 169 170 |
# File 'lib/em-ucengine/client.rb', line 168 def roster(meeting, &block) answer get(url "/meeting/#{meeting}/roster"), &block end |
#search(params, &block) ⇒ Object
Search
220 221 222 |
# File 'lib/em-ucengine/client.rb', line 220 def search(params, &block) answer get(url "/search/event/", params, &block) end |
#time(&block) ⇒ Object
Get server time
64 65 66 |
# File 'lib/em-ucengine/client.rb', line 64 def time(&block) answer get(url("/time")), &block end |
#update_meeting(meeting, body = {}, &block) ⇒ Object
Update a meeting
159 160 161 |
# File 'lib/em-ucengine/client.rb', line 159 def update_meeting(meeting, body={}, &block) answer put(url "/meeting//#{meeting}", body), &block end |
#update_user(uid, data, &block) ⇒ Object
Update user
109 110 111 |
# File 'lib/em-ucengine/client.rb', line 109 def update_user(uid, data, &block) answer put(url("/user/#{uid}"), data), &block end |
#url(*args) ⇒ Object
57 58 59 |
# File 'lib/em-ucengine/client.rb', line 57 def url(*args) uce.url(*args) end |
#user(uid, &block) ⇒ Object
Get user info
94 95 96 |
# File 'lib/em-ucengine/client.rb', line 94 def user(uid, &block) answer get(url("/user/#{uid}")), &block end |
#user_can(uid, action, object, conditions = {}, location = "", &block) ⇒ Object
Check user ACL
127 128 129 |
# File 'lib/em-ucengine/client.rb', line 127 def user_can(uid, action, object, conditions={}, location="", &block) answer_bool get(url("/user/#{uid}/can/#{action}/#{object}/#{location}"), :conditions => conditions), &block end |
#user_role(uid, params = {}, &block) ⇒ Object
Set a role to a user
262 263 264 |
# File 'lib/em-ucengine/client.rb', line 262 def user_role(uid, params={}, &block) answer post(url("/user/#{uid}/roles"), params), &block end |
#users(&block) ⇒ Object
List users
87 88 89 |
# File 'lib/em-ucengine/client.rb', line 87 def users(&block) answer get(url "/user"), &block end |