app/models/bigbluebutton_server.rb in bigbluebutton_rails-2.3.0 vs app/models/bigbluebutton_server.rb in bigbluebutton_rails-3.0.0
- old
+ new
@@ -26,16 +26,16 @@
:presence => true,
:length => { :maximum => 500 },
:format => { :with => /http[s]?:\/\/.*\/bigbluebutton\/api/,
:message => I18n.t('bigbluebutton_rails.servers.errors.url_format') }
- validates :param,
+ validates :slug,
:presence => true,
:uniqueness => true,
:length => { :minimum => 3 },
:format => { :with => /\A[a-zA-Z\d_]+[a-zA-Z\d_-]*[a-zA-Z\d_]+\z/,
- :message => I18n.t('bigbluebutton_rails.servers.errors.param_format') }
+ :message => I18n.t('bigbluebutton_rails.servers.errors.slug_format') }
validates :secret,
:presence => true,
:length => { :minimum => 1, :maximum => 500 }
@@ -45,11 +45,11 @@
# Array of <tt>BigbluebuttonMeeting</tt>
attr_reader :meetings
after_initialize :init
- before_validation :set_param
+ before_validation :set_slug
after_create :create_config
after_create :update_config
before_save :check_for_version_update
@@ -76,11 +76,11 @@
def api
return @api if @api.present?
version = self.version
version = set_api_version_from_server if version.blank?
- @api = BigBlueButton::BigBlueButtonApi.new(self.url, self.secret, version.to_s, false)
+ @api = BigBlueButton::BigBlueButtonApi.new(self.url, self.secret, version.to_s, BigbluebuttonRails.configuration.debug)
end
# Fetches the meetings currently created in the server (running or not).
#
# Using the response, updates <tt>meetings</tt> with a list of <tt>BigbluebuttonMeeting</tt>
@@ -158,11 +158,11 @@
BigbluebuttonRecording.sync(self, recordings[:recordings], full_sync)
end
end
def to_param
- self.param
+ self.slug
end
def set_api_version_from_server
begin
# creating the object with version=nil makes the gem fetch the version from the server
@@ -187,13 +187,13 @@
def init
# fetched attributes
@meetings = []
end
- # if :param wasn't set, sets it as :name downcase and parameterized
- def set_param
- if self.param.blank?
- self.param = self.name.parameterize.downcase unless self.name.nil?
+ # if :slug wasn't set, sets it as :name downcase and parameterized
+ def set_slug
+ if self.slug.blank?
+ self.slug = self.name.parameterize.downcase unless self.name.nil?
end
end
def create_config
BigbluebuttonServerConfig.create(server: self)