Class: Bigbluebutton::ServersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Bigbluebutton::ServersController
- Defined in:
- app/controllers/bigbluebutton/servers_controller.rb
Instance Method Summary collapse
- #activity ⇒ Object
- #check ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
-
#fetch_recordings ⇒ Object
- Accepts the following parameters in URL: meetings
-
A list of meetingIDs to be used as filter.
- #index ⇒ Object
- #new ⇒ Object
- #publish_recordings ⇒ Object
- #recordings ⇒ Object
- #show ⇒ Object
- #unpublish_recordings ⇒ Object
- #update ⇒ Object
Methods included from BigbluebuttonRails::InternalControllerMethods
Instance Method Details
#activity ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 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/bigbluebutton/servers_controller.rb', line 26 def activity error = false begin @server.fetch_meetings @server.meetings.each do |meeting| meeting.fetch_meeting_info end rescue BigBlueButton::BigBlueButtonException => e error = true = e.to_s[0..200] end # update_list works only for html if params[:update_list] && (params[:format].nil? || params[:format].to_s == "html") render :partial => 'activity_list', :locals => { :server => @server } return end respond_with @server.meetings do |format| # we return/render the fetched meetings even in case of error # but we set the error message in the response if error flash[:error] = format.html { render :activity } format.json { array = @server.meetings array.insert(0, { :message => }) render :json => array, :status => :error } else format.html format.json end end end |
#check ⇒ Object
155 156 157 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 155 def check redirect_to @server.check_url end |
#create ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 62 def create @server ||= BigbluebuttonServer.new(server_params) respond_with @server do |format| if @server.save format.html { = t('bigbluebutton_rails.servers.notice.create.success') redirect_to_using_params @server, :notice => } format.json { render :json => @server, :status => :created } else format.html { redirect_to_params_or_render :new } format.json { render :json => @server.errors., :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
94 95 96 97 98 99 100 101 102 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 94 def destroy # TODO: what if it fails? @server.destroy respond_with do |format| format.html { redirect_to_using_params } format.json { render :json => true, :status => :ok } end end |
#edit ⇒ Object
22 23 24 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 22 def edit respond_with(@server) end |
#fetch_recordings ⇒ Object
Accepts the following parameters in URL:
- meetings
-
A list of meetingIDs to be used as filter.
- meta_*
-
To filter by metadata, where “*” can be anything.
For example: fetch_recordings?meetings=meeting1,meeting2&meta_name=value
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 122 def fetch_recordings error = false begin # accept meetingID and meta_* filters filter = {} filter.merge!({ :meetingID => params[:meetings] }) if params[:meetings] params.each do |key, value| filter.merge!({ key.to_sym => value }) if key.match(/^meta_/) end @server.fetch_recordings(filter) = t('bigbluebutton_rails.servers.notice.fetch_recordings.success') rescue BigBlueButton::BigBlueButtonException => e error = true = e.to_s[0..200] end respond_with do |format| format.html { flash[error ? :error : :notice] = redirect_to (@server) } format.json { if error render :json => { :message => }, :status => :error else render :json => true, :status => :ok end } end end |
#index ⇒ Object
8 9 10 11 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 8 def index @servers ||= BigbluebuttonServer.all respond_with(@servers) end |
#new ⇒ Object
17 18 19 20 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 17 def new @server ||= BigbluebuttonServer.new respond_with(@server) end |
#publish_recordings ⇒ Object
109 110 111 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 109 def publish_recordings self.publish_unpublish(params[:recordings], true) end |
#recordings ⇒ Object
104 105 106 107 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 104 def recordings @recordings ||= @server.recordings respond_with(@recordings) end |
#show ⇒ Object
13 14 15 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 13 def show respond_with(@server) end |
#unpublish_recordings ⇒ Object
113 114 115 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 113 def unpublish_recordings self.publish_unpublish(params[:recordings], false) end |
#update ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 79 def update respond_with @server do |format| if @server.update_attributes(server_params) format.html { = t('bigbluebutton_rails.servers.notice.update.success') redirect_to_using_params @server, :notice => } format.json { render :json => true, :status => :ok } else format.html { redirect_to_params_or_render :edit } format.json { render :json => @server.errors., :status => :unprocessable_entity } end end end |