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.



96
97
98
99
100
# File 'app/models/cisco_webex_conference.rb', line 96

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

#after_findObject



127
128
129
# File 'app/models/cisco_webex_conference.rb', line 127

def after_find
  conference_status
end

#as_json(options = {}) ⇒ Object



131
132
133
134
# File 'app/models/cisco_webex_conference.rb', line 131

def as_json(options={})
  format_scheduled_date
  super(options)
end

#conference_statusObject

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
# File 'app/models/cisco_webex_conference.rb', line 62

def conference_status
  if self.started_at.nil?
    :created
  elsif meeting && self.ended_at.nil?
    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
end

#initiate_conferenceObject

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?
    options = {
      duration: self.duration || 999999,
      emails: settings[:external_emails].nil? ? [] : settings[:external_emails].strip.split(';'),
      scheduled_date: scheduled_date.in_time_zone(user.time_zone),
      time_zone: user.time_zone
    }
    webex_meeting = CanvasWebex::Meeting.create(self.title, options)
    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.



110
111
112
113
114
115
116
117
118
# File 'app/models/cisco_webex_conference.rb', line 110

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



123
124
125
# File 'app/models/cisco_webex_conference.rb', line 123

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

#scheduled_dateObject

Public: The schedule date of the conference

Returns the scheduled date of the conference or nil if there isn’t a scheduled date



86
87
88
# File 'app/models/cisco_webex_conference.rb', line 86

def scheduled_date
  @scheduled_date ||= user.time_zone.parse(settings[:scheduled_date]).utc unless settings[:scheduled_date].blank?
end