Class: CiscoWebexConference
- Inherits:
-
WebConference
- Object
- WebConference
- CiscoWebexConference
- 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
-
#admin_join_url(admin, _ = nil) ⇒ Object
Public: Add an admin to the conference and create a meeting URL (required by WebConference).
- #after_find ⇒ Object
- #as_json(options = {}) ⇒ Object
-
#conference_status ⇒ Object
Public: Determine the status of the conference (required by WebConference).
-
#initiate_conference ⇒ Object
Public: Start a new conference and return its key.
-
#participant_join_url(user, _ = nil) ⇒ Object
Public: Add a participant to the conference and create a meeting URL.
-
#recordings ⇒ Object
Public: List all of the recordings for a meeting.
-
#scheduled_date ⇒ Object
Public: The schedule date of the conference.
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.
101 102 103 104 105 |
# File 'app/models/cisco_webex_conference.rb', line 101 def admin_join_url(admin, _ = nil) if meeting meeting.host_url end end |
#after_find ⇒ Object
132 133 134 |
# File 'app/models/cisco_webex_conference.rb', line 132 def after_find conference_status end |
#as_json(options = {}) ⇒ Object
136 137 138 139 |
# File 'app/models/cisco_webex_conference.rb', line 136 def as_json(={}) format_scheduled_date super() end |
#conference_status ⇒ Object
Public: Determine the status of the conference (required by WebConference).
Returns conference status as a symbol (either :active or :closed).
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'app/models/cisco_webex_conference.rb', line 62 def conference_status begin if self.started_at.nil? initiate_conference if self.conference_key.blank? && scheduled_date.present? :created elsif self.ended_at.nil? && meeting if self.end_at && self.end_at > Time.now :active elsif self.end_at.nil? :active else :closed end else unless self.ended_at self.close self.end_at = self.ended_at self.save end :closed end rescue CanvasWebex::ConnectionError nil end end |
#initiate_conference ⇒ Object
Public: Start a new conference and return its key. (required by WebConference)
Returns a meeting.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/models/cisco_webex_conference.rb', line 44 def initiate_conference unless self.conference_key.present? = { duration: self.duration || 0, emails: settings[:external_emails].nil? ? [] : settings[:external_emails].strip.split(';'), time_zone: user.time_zone } [:scheduled_date] = scheduled_date.in_time_zone(user.time_zone) if scheduled_date.present? webex_session = CanvasWebex::WebexSession.create(self.title, ) self.conference_key = webex_session.session_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.
115 116 117 118 119 120 121 122 123 |
# File 'app/models/cisco_webex_conference.rb', line 115 def participant_join_url(user, _ = nil) if meeting if grants_right?(user, nil, :initiate) meeting.host_url else meeting.join_url end end end |
#recordings ⇒ Object
Public: List all of the recordings for a meeting
Returns an Array of recording hashes, or an empty Array if there are no recordings
128 129 130 |
# File 'app/models/cisco_webex_conference.rb', line 128 def recordings CanvasWebex::WebexSession.recordings(self.conference_key) end |
#scheduled_date ⇒ Object
Public: The schedule date of the conference
Returns the scheduled date of the conference or nil if there isn’t a scheduled date
91 92 93 |
# File 'app/models/cisco_webex_conference.rb', line 91 def scheduled_date @scheduled_date ||= user.time_zone.parse(settings[:scheduled_date]).utc unless settings[:scheduled_date].blank? end |