canvas_connect 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4f8ebc1059bca0c34578cd707e957962dcad3a7
4
- data.tar.gz: 23f9ce23f001ea3b6f4f77457fbc26331c989640
3
+ metadata.gz: b78cf0edc21638b06e639c666bcd9256646dd93a
4
+ data.tar.gz: 3f92a2cf1aa6fa71844742663d0a520c3f9398fb
5
5
  SHA512:
6
- metadata.gz: e1e721cc6a9eba791401e102871a813e9f5255169f86407627ba5105024a37c6f332aff221cf1b20bca61403875ea61172f933b9f58b8557c507c5ae8e0c8204
7
- data.tar.gz: ea512b073b4ee62f5e832ed14bcc5461afbded450f23a67219732f6c05fcd41ae33d009268dd286569da0006d7f2a41f781fd614607fa9ba643ee2e75d9159dd
6
+ metadata.gz: b0b9419da7ee66e6f63f8b99166eaac2fc6144931329de7350321b452c16d90a5c443316a601da462c17260ee2d4a7482b61d6c4cee19f4be0a609abb39caf70
7
+ data.tar.gz: f1a7c1a1df733b26493ac64f1e3e462a7c925784a2d3fbcfb0da721c9433adc94ceb9e7f2b34a50ed87eed3b9713e30dcf053cfb99b6b0a6a6bac41aded6a83f
@@ -18,6 +18,8 @@
18
18
 
19
19
  class AdobeConnectConference < WebConference
20
20
 
21
+ MAX_USERNAME_LENGTH = 60
22
+
21
23
  # Public: Start a new conference and return its key. (required by WebConference)
22
24
  #
23
25
  # Returns a conference key string.
@@ -98,9 +100,8 @@ class AdobeConnectConference < WebConference
98
100
  #
99
101
  # Returns the CanvasConnect::ConnectUser.
100
102
  def add_host(user)
101
- connect_email = user.email.gsub(/@/, "+canvas-#{user.uuid}@")
102
103
  options = { first_name: user.first_name, last_name: user.last_name,
103
- email: connect_email, username: connect_email, uuid: user.uuid }
104
+ email: connect_username(user), username: connect_username(user), uuid: user.uuid }
104
105
 
105
106
  connect_user = AdobeConnect::User.find(options) || AdobeConnect::User.create(options)
106
107
  connect_service.permissions_update(
@@ -111,6 +112,32 @@ class AdobeConnectConference < WebConference
111
112
  connect_user
112
113
  end
113
114
 
115
+ # Internal: Generate a Connect username that is under 60 characters
116
+ # (the username limit on our Connect instance).
117
+ #
118
+ # user - The Canvas user to generate a username for.
119
+ #
120
+ # Returns a username string.
121
+ def connect_username(user)
122
+ return @connect_username unless @connect_username.nil?
123
+
124
+ preferred_extension = 'canvas-connect'
125
+ current_address = user.email
126
+ allowed_length = MAX_USERNAME_LENGTH - current_address.length
127
+ allowed_length -= 1 unless current_address.match(/\+/)
128
+ postfix = if allowed_length >= preferred_extension.length
129
+ preferred_extension
130
+ else
131
+ user.uuid[0..allowed_length - 1]
132
+ end
133
+
134
+ @connect_username = if current_address.match(/\+/)
135
+ current_address.gsub(/\+/, "+#{postfix}")
136
+ else
137
+ current_address.gsub(/@/, "+#{postfix}@")
138
+ end
139
+ end
140
+
114
141
  # Internal: Create a new Connect meeting.
115
142
  #
116
143
  # Returns nothing.
@@ -1,3 +1,3 @@
1
1
  module CanvasConnect
2
- VERSION = '0.0.9'
2
+ VERSION = '0.1.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canvas_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Pendleton