I’ve been using greenlight v2 until very recently, and since I’m dealing with large number of classes every semester I came up with this code to create batch classes in greenlight using Ruby on rails:
classNames = ["Test1", "Test2"]
7.times.map{
roomNames = []
for i in 0..Room.all.length-1
roomName = Room.all[i].name
roomNames .append(roomName)
end
for i in 0..classNames.length
className= classNames[i]
if roomNames.include?(className) == true
classNames.delete(className)
end
end
}
urls = Array.new(classNames.length)
moderatorCodes = classNames.length.times.map{([*1..9].shuffle[0..0].join).concat([*'a'..'z'].shuffle[0..4].join)}
for i in 0..classNames.length
className= classNames[i]
moderatorCode= moderatorCodes[i]
urls[i] = Room.create(user_id: 1, name: className, room_settings: "{"muteOnStart":true,"requireModeratorApproval":false,"anyoneCanStart":false,"joinModerator":false}",moderator_access_code: moderatorCode).uid
puts [classNames[i],urls[i],moderatorCodes[i]].inspect
end
Which gave me an array of class names, urls and randomly created moderator codes for each class.
Now in the new version of greenlight (v3), there seems to be no moderator_access_code attribute.
I would appreciate it if you could help me come up with a solution to reach the same array of [name, url, moderator code] in greenlight v3 using Ruby on rails.
I couldn’t find any solutions online
Kian Ashoory is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.