Class: CiscoWebexConference

Inherits:
WebConference
  • Object
show all
Defined in:
app/models/cisco_webex_conference.rb

Overview

Copyright © 2013 Instructure, Inc.

This file is part of Canvas.

Canvas is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License.

Canvas is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <www.gnu.org/licenses/>.

Instance Method Summary collapse

Instance Method Details

#admin_join_url(admin, _ = nil) ⇒ Object

Public: Add an admin to the conference and create a meeting URL (required by WebConference).

admin - The user to add to the conference as an admin. _ - Included for compatibility w/ web_conference.rb

Returns a meeting URL string.



53
54
55
56
57
# File 'app/models/cisco_webex_conference.rb', line 53

def admin_join_url(admin, _ = nil)
  if meeting
    meeting.host_url
  end
end

#after_findObject



84
85
86
# File 'app/models/cisco_webex_conference.rb', line 84

def after_find
  conference_status
end

#conference_statusObject

Public: Determine the status of the conference (required by WebConference).

Returns conference status as a symbol (either :active or :closed).



38
39
40
41
42
43
44
45
# File 'app/models/cisco_webex_conference.rb', line 38

def conference_status
  if meeting || self.started_at.nil?
    :active
  else
    self.close unless self.ended_at
    :closed
  end
end

#initiate_conferenceObject

Public: Start a new conference and return its key. (required by WebConference)

Returns a meeting.



24
25
26
27
28
29
30
31
32
33
# File 'app/models/cisco_webex_conference.rb', line 24

def initiate_conference
  unless self.conference_key.present?
    webex_meeting = CanvasWebex::Meeting.create(self.title)
    options = {}
    options[:duration] = self.duration || 999999
    self.conference_key = webex_meeting.meeting_key
    save
  end
  self.conference_key
end

#participant_join_url(user, _ = nil) ⇒ Object

Public: Add a participant to the conference and create a meeting URL.

Make the user a conference admin if they have permissions to create
a conference (required by WebConference).

user - The user to add to the conference as an admin. _ - Included for compatibility w/ web_conference.rb

Returns a meeting URL string.



67
68
69
70
71
72
73
74
75
# File 'app/models/cisco_webex_conference.rb', line 67

def participant_join_url(user, _ = nil)
  if meeting
    if grants_right?(user, nil, :initiate)
      meeting.host_url
    else
      meeting.join_url
    end
  end
end

#recordingsObject

Public: List all of the recordings for a meeting

Returns an Array of recording hashes, or an empty Array if there are no recordings



80
81
82
# File 'app/models/cisco_webex_conference.rb', line 80

def recordings
  CanvasWebex::Meeting.recordings(self.conference_key)
end