Class: CanvasWebex::WebexSession
- Inherits:
-
Object
- Object
- CanvasWebex::WebexSession
- Defined in:
- lib/canvas_webex/webex_session.rb
Class Method Summary collapse
- .create(meeting_name, options = {}, client = CanvasWebex.client) ⇒ Object
- .parse_time_stamp(time_zone, time_stamp, client = CanvasWebex.client) ⇒ Object
- .recordings(session_key, client = CanvasWebex.client) ⇒ Object
Instance Method Summary collapse
Class Method Details
.create(meeting_name, options = {}, client = CanvasWebex.client) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/canvas_webex/webex_session.rb', line 21 def self.create(meeting_name, = {}, client = CanvasWebex.client) case client.webex_service when 'meeting' CanvasWebex::Meeting.create(meeting_name, , client) when 'training' CanvasWebex::Training.create(meeting_name, , client) end end |
.parse_time_stamp(time_zone, time_stamp, client = CanvasWebex.client) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/canvas_webex/webex_session.rb', line 64 def self.parse_time_stamp(time_zone, time_stamp, client = CanvasWebex.client) if response = client.list_time_zone(time_zone, time_stamp) if m_offset = response.at_xpath('timeZone/gmtOffset').try(:text).try(:to_i) offset_string = "%+0#3d:00" %[(m_offset / 60)] DateTime.strptime(time_stamp + offset_string, '%m/%d/%Y %H:%M:%S%z') else DateTime.strptime(time_stamp, '%m/%d/%Y %H:%M:%S') end else "" end end |
.recordings(session_key, client = CanvasWebex.client) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/canvas_webex/webex_session.rb', line 42 def self.recordings(session_key, client = CanvasWebex.client) if response = session_key && client.list_recordings(session_key) response.search('recording').map do |rec_xml| created_ts = rec_xml.at_xpath('createTime').try(:text) tz_id = rec_xml.at_xpath('timeZoneID').try(:text) created_at = self.parse_time_stamp(tz_id, created_ts) recording = { recording_id: rec_xml.at_xpath('recordingID').try(:text), title: rec_xml.at_xpath('name').try(:text), playback_url: rec_xml.at_xpath('streamURL').try(:text), created_at: self.parse_time_stamp(tz_id, created_ts).to_s } if duration = rec_xml.at_xpath('duration').try(:text) recording[:duration_minutes] = duration.to_i / 60 end recording end else [] end end |
Instance Method Details
#host_url(client = CanvasWebex.client) ⇒ Object
30 31 32 33 34 |
# File 'lib/canvas_webex/webex_session.rb', line 30 def host_url(client = CanvasWebex.client) if response = client.host_meeting_url(session_key, nil) response.at_xpath('hostMeetingURL').try(:text) end end |
#join_url(client = CanvasWebex.client) ⇒ Object
36 37 38 39 40 |
# File 'lib/canvas_webex/webex_session.rb', line 36 def join_url(client = CanvasWebex.client) if response = client.join_meeting_url(session_key, nil) response.at_xpath('joinMeetingURL').text end end |