Module: CommonEngine::ZoomUtility

Extended by:
ActiveSupport::Concern
Included in:
ApplicationBaseController
Defined in:
app/controllers/concerns/zoom_utility.rb

Constant Summary collapse

ZOOM_PASSWORD =
'asp123'.freeze
ZOOM_USER_LAST_NAME =
'AfterSchool-Project'.freeze
ZOOM_DATETIME_FORMAT =
"%Y-%m-%d'T'%H:%M:%S'Z'".freeze
ZOOM_DURATION =
90.freeze

Instance Method Summary collapse

Instance Method Details

#create_meeting(zoom_user_id, chapter_id, start_datetime) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'app/controllers/concerns/zoom_utility.rb', line 38

def create_meeting(zoom_user_id, chapter_id, start_datetime)
  url = 'https://api.zoom.us/v2/users/' + zoom_user_id + '/meetings'
  chapter = CommonEngine::Chapter.joins(:course).includes(:course).find(chapter_id)
  data = {
    topic: chapter.course.name + ' ' + chapter.name,
    type: 2,
    start_time: start_datetime.strftime(ZOOM_DATETIME_FORMAT),
    duration: ZOOM_DURATION,
    timezone: t('common.time_zone'),
    password: ZOOM_PASSWORD,
    settings: {
      host_video: false,
      participant_video: false,
      join_before_host: true,
      watermark: true,
      approval_type: 2,
      audio: 'both',
      auto_recording: 'none',
      enforce_login: false
    }
  }
  return ActiveSupport::JSON.decode(send_ssl_post(url, data).body)
end

#create_zoom_user(email) ⇒ Object

see zoom.github.io/api/?shell#create-a-user for more information



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/concerns/zoom_utility.rb', line 16

def create_zoom_user(email)
  url = 'https://api.zoom.us/v2/users'
  data = {
    action: 'create',
    user_info: {
      email: email,
      password: ZOOM_PASSWORD,
      type: 1
    }
  }
  return ActiveSupport::JSON.decode(send_ssl_post(url, data).body)
end

#delete_zoom_user(email) ⇒ Object



29
30
31
32
33
34
35
# File 'app/controllers/concerns/zoom_utility.rb', line 29

def delete_zoom_user(email)
  url = 'https://api.zoom.us/v2/users/' + email
  data = {
    action: 'delete'
  }
  send_ssl_delete(url, data).body
end