create graph api client to handle requests
This commit is contained in:
@@ -26,7 +26,8 @@ class BroadcastsController < ApplicationController
|
||||
end
|
||||
|
||||
def show
|
||||
@conference_url = url_for [@broadcast.project, @broadcast, :zoom_meeting]
|
||||
# @conference_url = url_for [@broadcast.project, @broadcast, :zoom_meeting]
|
||||
@conference_url = url_for [@broadcast.project, @broadcast, :microsoft_teams_meeting]
|
||||
@recordings = @broadcast.broadcast_recordings.order_by_recent.paginate(page: params[:page])
|
||||
@files = @broadcast.files.order("created_at DESC").paginate(page: params[:files_page])
|
||||
render layout: 'application'
|
||||
|
||||
@@ -5,9 +5,11 @@ class CallbacksController < ApplicationController
|
||||
skip_before_action :verify_authenticity_token
|
||||
|
||||
def create
|
||||
uid = request.env['omniauth.auth'][:uid]
|
||||
token_data = request.env['omniauth.auth'][:credentials]
|
||||
|
||||
current_user&.tap do |user|
|
||||
user.microsoft_user_id = uid
|
||||
user.microsoft_access_token = token_data.token
|
||||
user.microsoft_refresh_token = token_data.refresh_token
|
||||
user.microsoft_token_expires_at = token_data.expires_at # Expiration time is returned in seconds
|
||||
|
||||
17
app/controllers/microsoft_teams_meetings_controller.rb
Normal file
17
app/controllers/microsoft_teams_meetings_controller.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class MicrosoftTeamsMeetingsController < ApplicationController
|
||||
require 'microsoft_graph'
|
||||
def show
|
||||
authorize broadcast = Broadcast.find(params[:broadcast_id])
|
||||
|
||||
graph_api = MicrosoftGraph.new(current_user, ENV['AZURE_CLIENT_ID'], ENV['AZURE_CLIENT_SECRET'], ENV['AZURE_SCOPES'])
|
||||
|
||||
meeting_start = DateTime.now
|
||||
meeting_end = DateTime.now + 1.hour
|
||||
subject = "Broadcast Meeting"
|
||||
|
||||
|
||||
r = graph_api.create_teams_meeting(meeting_start, meeting_end, subject)
|
||||
|
||||
render plain: r
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user