d2l_sdk 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +28 -0
- data/.fasterer.yml +28 -0
- data/.rubocop.yml +67 -0
- data/.vscode/settings.json +9 -0
- data/Gemfile +3 -2
- data/README.md +341 -63
- data/d2l_sdk.gemspec +1 -0
- data/lib/d2l_sdk/auth.rb +1 -1
- data/lib/d2l_sdk/calendar.rb +11 -12
- data/lib/d2l_sdk/config.rb +29 -29
- data/lib/d2l_sdk/config_variables.rb +27 -39
- data/lib/d2l_sdk/course.rb +53 -47
- data/lib/d2l_sdk/course_content.rb +60 -54
- data/lib/d2l_sdk/course_template.rb +19 -14
- data/lib/d2l_sdk/datahub.rb +28 -28
- data/lib/d2l_sdk/demographics.rb +23 -8
- data/lib/d2l_sdk/discussions.rb +361 -56
- data/lib/d2l_sdk/dropbox.rb +208 -16
- data/lib/d2l_sdk/enroll.rb +9 -9
- data/lib/d2l_sdk/grades.rb +7 -7
- data/lib/d2l_sdk/group.rb +42 -42
- data/lib/d2l_sdk/logging.rb +2 -2
- data/lib/d2l_sdk/lti.rb +243 -11
- data/lib/d2l_sdk/news.rb +2 -2
- data/lib/d2l_sdk/org_unit.rb +20 -18
- data/lib/d2l_sdk/requests.rb +105 -69
- data/lib/d2l_sdk/section.rb +13 -12
- data/lib/d2l_sdk/semester.rb +6 -5
- data/lib/d2l_sdk/setup_versions.rb +7 -7
- data/lib/d2l_sdk/user.rb +48 -58
- data/lib/d2l_sdk/version.rb +1 -1
- metadata +6 -5
- data/change_lastname.rb +0 -65
- data/lol.txt +0 -1
- data/test.rb +0 -19
data/lib/d2l_sdk/section.rb
CHANGED
@@ -56,10 +56,11 @@ end
|
|
56
56
|
|
57
57
|
# Create a new section in a particular org unit.
|
58
58
|
def create_org_unit_section(org_unit_id, section_data)
|
59
|
-
payload = {
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
payload = {
|
60
|
+
'Name' => '', # String
|
61
|
+
'Code' => '', # String
|
62
|
+
'Description' => {}, # RichTextInput -- e.g. {'Content'=>'x', 'Type'=>'y'}
|
63
|
+
}.merge!(section_data)
|
63
64
|
# Check the validity of the SectionData that is passed as a payload
|
64
65
|
check_section_data_validity(payload)
|
65
66
|
path = "/d2l/api/lp/#{$lp_ver}/#{org_unit_id}/sections/"
|
@@ -82,9 +83,8 @@ def check_section_enrollment_validity(section_enrollment)
|
|
82
83
|
end
|
83
84
|
|
84
85
|
# Enroll a user in a section for a particular org unit.
|
85
|
-
def enroll_user_in_org_unit_section(org_unit_id,section_id, section_data)
|
86
|
-
payload = { 'UserId' => 9999
|
87
|
-
}.merge!(section_data)
|
86
|
+
def enroll_user_in_org_unit_section(org_unit_id, section_id, section_data)
|
87
|
+
payload = { 'UserId' => 9999 }.merge!(section_data) # Number : D2LID
|
88
88
|
# Check the validity of the SectionEnrollment that is passed as a payload
|
89
89
|
check_section_enrollment_validity(payload)
|
90
90
|
path = "/d2l/api/lp/#{$lp_ver}/#{org_unit_id}/sections/#{section_id}/enrollments/"
|
@@ -143,13 +143,14 @@ end
|
|
143
143
|
|
144
144
|
# Update information for a section in a particular org unit.
|
145
145
|
def update_org_unit_section_info(org_unit_id, section_id, section_data)
|
146
|
-
payload = {
|
147
|
-
|
148
|
-
|
149
|
-
|
146
|
+
payload = {
|
147
|
+
'Name' => '', # String
|
148
|
+
'Code' => '', # String
|
149
|
+
'Description' => {}, # RichTextInput -- e.g. {'Content'=>'x', 'Type'=>'y'}
|
150
|
+
}.merge!(section_data)
|
150
151
|
# Check the validity of the SectionData that is passed as a payload
|
151
152
|
check_section_data_validity(payload)
|
152
|
-
path = "/d2l/api/lp/#{$lp_ver}/#{org_unit_id}/sections
|
153
|
+
path = "/d2l/api/lp/#{$lp_ver}/#{org_unit_id}/sections/#{section_id}"
|
153
154
|
# JSON param: SectionData
|
154
155
|
_put(path, payload)
|
155
156
|
# returns the SectionData JSON block, in its Fetch form
|
data/lib/d2l_sdk/semester.rb
CHANGED
@@ -21,11 +21,12 @@ end
|
|
21
21
|
# via executing a POST http method using a predefined path and the new payload.
|
22
22
|
def create_semester_data(semester_data)
|
23
23
|
# Define a valid, empty payload and merge! with the semester_data. Print it.
|
24
|
-
payload = {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
payload = {
|
25
|
+
'Type' => 5, # Number:D2LID
|
26
|
+
'Name' => 'Winter 2013 Semester', # String
|
27
|
+
'Code' => '201701', # String #YearNUM where NUM{sp:01,su:06,fl:08}
|
28
|
+
'Parents' => [6606], # ARR of Number:D2LID
|
29
|
+
}.merge!(semester_data)
|
29
30
|
# ap payload
|
30
31
|
check_semester_data_validity(payload)
|
31
32
|
path = "/d2l/api/lp/#{$lp_ver}/orgstructure/"
|
@@ -9,14 +9,14 @@ $bas_ver = get_latest_product_version('bas') # Award service
|
|
9
9
|
$lti_ver = get_latest_product_version('lti') # learning tools interoperability
|
10
10
|
# ext
|
11
11
|
|
12
|
-
#lti, rp, LR, ext,
|
12
|
+
# lti, rp, LR, ext,
|
13
13
|
puts "versions set to:"
|
14
14
|
versions = {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
'Learning Environment' => $le_ver,
|
16
|
+
'Learning Platform' => $lp_ver,
|
17
|
+
'Eportfolio' => $ep_ver,
|
18
|
+
'Learning Object Repository' => $LR_ver,
|
19
|
+
'Award Service' => $bas_ver,
|
20
|
+
'Learning Tools Interoperability' => $lti_ver
|
21
21
|
}
|
22
22
|
ap versions
|
data/lib/d2l_sdk/user.rb
CHANGED
@@ -19,7 +19,7 @@ def check_user_data_validity(user_data)
|
|
19
19
|
'properties' => {
|
20
20
|
'OrgDefinedId' => { 'type' => 'string' },
|
21
21
|
'FirstName' => { 'type' => 'string' },
|
22
|
-
'MiddleName' => { 'type' =>
|
22
|
+
'MiddleName' => { 'type' => %w(string null) },
|
23
23
|
'LastName' => { 'type' => 'string' },
|
24
24
|
'ExternalEmail' => { 'type' => %w(string null) },
|
25
25
|
'UserName' => { 'type' => 'string' },
|
@@ -39,7 +39,9 @@ end
|
|
39
39
|
# exists in your system.
|
40
40
|
def create_user_data(user_data)
|
41
41
|
# Define a valid, empty payload and merge! with the user_data. Print it.
|
42
|
-
payload =
|
42
|
+
payload =
|
43
|
+
{
|
44
|
+
'OrgDefinedId' => '', # String
|
43
45
|
'FirstName' => 'TestUser', # String
|
44
46
|
'MiddleName' => 'Test', # String
|
45
47
|
'LastName' => 'Test', # String
|
@@ -108,11 +110,7 @@ end
|
|
108
110
|
# Checks whether a username already exists
|
109
111
|
# returns: true if the the user exists already
|
110
112
|
def does_user_exist(username)
|
111
|
-
|
112
|
-
return true
|
113
|
-
else
|
114
|
-
return false
|
115
|
-
end
|
113
|
+
!get_user_by_username(username.to_s).nil?
|
116
114
|
end
|
117
115
|
|
118
116
|
# Initiates a multithreaded search to streamline the search of a user based upon
|
@@ -167,24 +165,24 @@ end
|
|
167
165
|
# returns: array::matching_names
|
168
166
|
def _get_user_by_string(parameter, search_string, range, regex = false)
|
169
167
|
# puts "searching from #{range.min.to_s} to #{range.max.to_s}"
|
170
|
-
|
168
|
+
baseline = range.min
|
171
169
|
matching_names = []
|
172
170
|
# Average difference between each paged bookmarks beginnings is 109.6
|
173
|
-
while
|
174
|
-
# path = "/d2l/api/lp/#{$lp_ver}/users/?bookmark=" +
|
175
|
-
response = get_users_by_bookmark(
|
171
|
+
while baseline.to_i < range.max
|
172
|
+
# path = "/d2l/api/lp/#{$lp_ver}/users/?bookmark=" + baseline.to_s
|
173
|
+
response = get_users_by_bookmark(baseline.to_s)
|
176
174
|
if response['PagingInfo']['HasMoreItems'] == false
|
177
175
|
# ap 'response returned zero items, last page possible for this thread..'
|
178
176
|
return matching_names
|
179
177
|
end
|
180
178
|
response['Items'].each do |user|
|
181
179
|
if regex && !user[parameter].nil?
|
182
|
-
matching_names.push(user)
|
180
|
+
matching_names.push(user) unless (user[parameter] =~ search_string).nil?
|
183
181
|
elsif !user[parameter].nil?
|
184
182
|
matching_names.push(user) if user[parameter].include? search_string
|
185
183
|
end
|
186
184
|
end
|
187
|
-
|
185
|
+
baseline = response['PagingInfo']['Bookmark']
|
188
186
|
end
|
189
187
|
matching_names
|
190
188
|
end
|
@@ -214,7 +212,7 @@ def check_updated_user_data_validity(user_data)
|
|
214
212
|
'properties' => {
|
215
213
|
'OrgDefinedId' => { 'type' => %w(string null) },
|
216
214
|
'FirstName' => { 'type' => 'string' },
|
217
|
-
'MiddleName' => { 'type' =>
|
215
|
+
'MiddleName' => { 'type' => %w(string null) },
|
218
216
|
'LastName' => { 'type' => 'string' },
|
219
217
|
'ExternalEmail' => { 'type' => %w(string null) },
|
220
218
|
'UserName' => { 'type' => 'string' },
|
@@ -254,7 +252,7 @@ def update_user_data(user_id, new_data)
|
|
254
252
|
# Define a path referencing the user data using the user_id
|
255
253
|
path = "/d2l/api/lp/#{$lp_ver}/users/" + user_id.to_s
|
256
254
|
_put(path, payload)
|
257
|
-
puts '[+] User data updated successfully'.green
|
255
|
+
# puts '[+] User data updated successfully'.green
|
258
256
|
# Returns a UserData JSON block of the updated user's data
|
259
257
|
end
|
260
258
|
|
@@ -272,28 +270,25 @@ end
|
|
272
270
|
# ACTIVATION:###########
|
273
271
|
########################
|
274
272
|
# REVIEW: Retrieve a particular user’s activation settings.
|
275
|
-
# RETURNS: a UserActivationData JSON block with the
|
273
|
+
# RETURNS: a UserActivationData JSON block with the current activation status.
|
276
274
|
def get_user_activation_settings(user_id)
|
277
275
|
path = "/d2l/api/lp/#{$lp_ver}/users/#{user_id}/activation"
|
278
276
|
_get(path)
|
279
|
-
# RETURNS: a UserActivationData JSON block with the
|
277
|
+
# RETURNS: a UserActivationData JSON block with the current activation status of the user.
|
280
278
|
end
|
281
279
|
|
282
280
|
# REVIEW: Update a particular user’s activation settings.
|
283
281
|
# RETURNS: ?
|
284
282
|
def update_user_activation_settings(user_id, is_active)
|
285
283
|
# PUT /d2l/api/lp/(version)/users/(userId)/activation
|
286
|
-
if is_active != true && is_active != false
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
_put(path, payload)
|
295
|
-
# RETURNS: ?
|
296
|
-
end
|
284
|
+
raise ArgumentError, 'is_active is not a boolean' if is_active != true && is_active != false
|
285
|
+
path = "/d2l/api/lp/#{$lp_ver}/users/#{user_id}/activation"
|
286
|
+
payload =
|
287
|
+
{
|
288
|
+
"IsActive" => is_active
|
289
|
+
}
|
290
|
+
_put(path, payload)
|
291
|
+
# RETURNS: ?
|
297
292
|
end
|
298
293
|
|
299
294
|
########################
|
@@ -307,7 +302,6 @@ def link_user_google_apps_account(google_apps_linking_item)
|
|
307
302
|
# POST /d2l/api/gae/(version)/linkuser
|
308
303
|
end
|
309
304
|
|
310
|
-
|
311
305
|
########################
|
312
306
|
# NOTIFICATIONS:########
|
313
307
|
########################
|
@@ -360,17 +354,12 @@ end
|
|
360
354
|
# REVIEW: Update a particular user’s password.
|
361
355
|
# NOTE: 400 errors are implicitly invalid password
|
362
356
|
def update_user_password(user_id, user_password_data)
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
else
|
368
|
-
raise ArgumentError, "Argument 'user_password_data' is not a String"
|
369
|
-
end
|
357
|
+
raise ArgumentError, "Argument 'user_password_data' is not a String" unless user_password_data.is_a? String
|
358
|
+
path = "/d2l/api/lp/#{$lp_ver}/users/#{user_id}/password"
|
359
|
+
payload = { "Password" => user_password_data }
|
360
|
+
_put(path, payload)
|
370
361
|
end
|
371
362
|
|
372
|
-
|
373
|
-
|
374
363
|
########################
|
375
364
|
# ROLES:################
|
376
365
|
########################
|
@@ -406,7 +395,6 @@ def create_new_role_from_existing_role(deep_copy_role_id, role_copy_data)
|
|
406
395
|
# POST /d2l/api/lp/(version)/roles/
|
407
396
|
end
|
408
397
|
|
409
|
-
|
410
398
|
########################
|
411
399
|
# PROFILES:#############
|
412
400
|
########################
|
@@ -478,7 +466,6 @@ def get_user_profile_by_user_id(user_id)
|
|
478
466
|
# Returns UserProfile JSON data block
|
479
467
|
end
|
480
468
|
|
481
|
-
|
482
469
|
# Retrieve a particular profile image, by User ID.
|
483
470
|
# RETURNS: This action returns a file stream containing the current user’s
|
484
471
|
# profile image. Note that the back-end service may return a
|
@@ -589,26 +576,26 @@ end
|
|
589
576
|
# REVIEW: retrieve list of known LIS roles
|
590
577
|
def get_lis_roles(lis_urn = "")
|
591
578
|
path = "/d2l/api/lp/#{$lp_ver}/imsconfig/roles/"
|
592
|
-
path +=
|
579
|
+
path += lis_urn.to_s if lis_urn != ""
|
593
580
|
_get(path)
|
594
581
|
# returns array of LIS role data blocks
|
595
582
|
end
|
596
583
|
|
597
584
|
# NOTE: UNSTABLE
|
598
585
|
# REVIEW: retrieve mappings between user roles and LIS roles
|
599
|
-
def
|
586
|
+
def get_user_role_lis_mappings_by_urn(lis_urn = "", d2lid = 0)
|
600
587
|
path = "/d2l/api/lp/#{$lp_ver}/imsconfig/map/roles/"
|
601
|
-
path +=
|
602
|
-
path +=
|
588
|
+
path += lis_urn.to_s if lis_urn != ""
|
589
|
+
path += d2lid.to_s if d2lid != 0
|
603
590
|
_get(path)
|
604
591
|
# returns JSON array of LIS role mapping data blocks
|
605
592
|
end
|
606
593
|
|
607
594
|
# NOTE: UNSTABLE
|
608
595
|
# REVIEW: retrieve mapping between a user role and a LIS role
|
609
|
-
def
|
596
|
+
def get_user_role_lis_mappings_by_role(role_id, d2lid = 0)
|
610
597
|
path = "/d2l/api/lp/#{$lp_ver}/imsconfig/map/roles/#{role_id}"
|
611
|
-
path +=
|
598
|
+
path += d2lid.to_s if d2lid != 0
|
612
599
|
_get(path)
|
613
600
|
# returns JSON array of LIS role mapping data blocks
|
614
601
|
end
|
@@ -620,7 +607,6 @@ def map_user_role_to_lis_roles(role_id, mappings)
|
|
620
607
|
# PUT /d2l/api/lp/(version)/imsconfig/map/roles/(roleId)
|
621
608
|
end
|
622
609
|
|
623
|
-
|
624
610
|
########################
|
625
611
|
# SETTINGS:#############
|
626
612
|
########################
|
@@ -641,30 +627,34 @@ def get_locale_account_settings(user_id)
|
|
641
627
|
# returns Locale JSON block
|
642
628
|
end
|
643
629
|
|
644
|
-
|
645
|
-
|
646
|
-
# TODO: Add schema check for update_locale conforming to the D2L update_locale
|
630
|
+
# Add schema check for update_locale conforming to the D2L update_locale
|
647
631
|
# JSON data block of form: { "LocaleId" : <D2LID>}.
|
648
|
-
def
|
649
|
-
|
632
|
+
def valid_locale_id?(locale_id)
|
633
|
+
# check if its an integer OR if its a string comprised of only numbers.
|
634
|
+
locale_id.is_a?(Numeric) || locale_id.is_a?(String) && !!locale_id.match(/^(\d)+$/)
|
650
635
|
end
|
651
636
|
|
652
637
|
# REVIEW: Update the current user’s locale account settings.
|
653
|
-
# TODO: Add schema check for update_locale
|
654
638
|
# update_locale = { "LocaleId" : <D2LID>}
|
655
|
-
def update_current_user_locale_account_settings(
|
656
|
-
|
639
|
+
def update_current_user_locale_account_settings(locale_id)
|
640
|
+
unless valid_locale_id?(locale_id)
|
641
|
+
raise ArgumentError, "Variable 'update_locale' is not a "
|
642
|
+
end
|
643
|
+
payload = { 'LocaleId' => locale_id }
|
657
644
|
path = "/d2l/api/lp/#{$lp_ver}/accountSettings/mysettings/locale/"
|
645
|
+
|
658
646
|
# requires UpdateSettings JSON data block
|
659
647
|
# update_locale = { "LocaleId" : <D2LID>}
|
660
648
|
_put(path, payload)
|
661
649
|
end
|
662
650
|
|
663
651
|
# REVIEW: Update the locale account settings for a particular user.
|
664
|
-
# TODO: Add schema check for update_locale
|
665
652
|
# update_locale = { "LocaleId" : <D2LID>}
|
666
|
-
def update_user_locale_account_settings(user_id,
|
667
|
-
|
653
|
+
def update_user_locale_account_settings(user_id, locale_id)
|
654
|
+
unless valid_locale_id?(locale_id)
|
655
|
+
raise ArgumentError, "Variable 'update_locale' is not a "
|
656
|
+
end
|
657
|
+
payload = { 'LocaleId' => locale_id }
|
668
658
|
path = "/d2l/api/lp/#{$lp_ver}/accountSettings/#{user_id}/locale/"
|
669
659
|
# requires UpdateSettings JSON data block
|
670
660
|
# update_locale = { "LocaleId" : <D2LID>}
|
data/lib/d2l_sdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: d2l_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kulpa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03
|
11
|
+
date: 2017-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -144,9 +144,13 @@ executables: []
|
|
144
144
|
extensions: []
|
145
145
|
extra_rdoc_files: []
|
146
146
|
files:
|
147
|
+
- ".codeclimate.yml"
|
148
|
+
- ".fasterer.yml"
|
147
149
|
- ".gitignore"
|
148
150
|
- ".rspec"
|
151
|
+
- ".rubocop.yml"
|
149
152
|
- ".travis.yml"
|
153
|
+
- ".vscode/settings.json"
|
150
154
|
- CODE_OF_CONDUCT.md
|
151
155
|
- Gemfile
|
152
156
|
- Gemfile.lock
|
@@ -155,7 +159,6 @@ files:
|
|
155
159
|
- Rakefile
|
156
160
|
- bin/console
|
157
161
|
- bin/setup
|
158
|
-
- change_lastname.rb
|
159
162
|
- d2l_sdk.gemspec
|
160
163
|
- example_scripts/adjusted_courses.txt
|
161
164
|
- example_scripts/fix_201708_courses.rb
|
@@ -192,8 +195,6 @@ files:
|
|
192
195
|
- lib/d2l_sdk/setup_versions.rb
|
193
196
|
- lib/d2l_sdk/user.rb
|
194
197
|
- lib/d2l_sdk/version.rb
|
195
|
-
- lol.txt
|
196
|
-
- test.rb
|
197
198
|
- tests/All_Crud_test.rb
|
198
199
|
- tests/ETL_listener.rb
|
199
200
|
- tests/TestCourseCRUD.rb
|
data/change_lastname.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
require 'd2l_sdk'
|
2
|
-
|
3
|
-
# Setup vars for username and last name
|
4
|
-
# retrieved via rundeck args passed to this script.
|
5
|
-
@username = ARGV[0]
|
6
|
-
@new_lastname = ARGV[1]
|
7
|
-
@debug = false
|
8
|
-
|
9
|
-
# Check that the user exists.
|
10
|
-
# If the username doesn't exist, then raise.
|
11
|
-
# Why: You can't change a user's profile that you can't reference.
|
12
|
-
if !does_user_exist(@username)
|
13
|
-
raise ArgumentError, "ARGV[0], '#{@username}', is not a username that exists."
|
14
|
-
end
|
15
|
-
|
16
|
-
# Already asserted that the user exists. Retrieve Hash of the user's profile.
|
17
|
-
user_profile = get_user_by_username(@username)
|
18
|
-
|
19
|
-
# debug code
|
20
|
-
puts "Old User Data: \n" if @debug
|
21
|
-
ap user_profile if @debug
|
22
|
-
|
23
|
-
# Change the previous d2l user data and create a new json-formatted
|
24
|
-
# payload. The payload is merged! with a skeleton payload, but it as
|
25
|
-
# each parameter is defined, this will not affect its usage.
|
26
|
-
old_lastname = user_profile["LastName"]
|
27
|
-
user_profile["LastName"] = @new_lastname # update the user's lastname
|
28
|
-
user_profile["UserName"].sub! old_lastname, @new_lastname # update the user's username
|
29
|
-
unless user_profile["ExternalEmail"].nil?
|
30
|
-
user_profile["ExternalEmail"].sub! old_lastname, @new_lastname # update the user's email
|
31
|
-
end
|
32
|
-
|
33
|
-
# Check if there already is a user created with the +new username+
|
34
|
-
if does_user_exist(user_profile["UserName"])
|
35
|
-
raise RuntimeError, "A user already exists with the new username, '#{user_profile["UserName"]}'."
|
36
|
-
end
|
37
|
-
|
38
|
-
# Pull in data only necessary for user_data in +update+ form.
|
39
|
-
new_user_data =
|
40
|
-
{
|
41
|
-
'OrgDefinedId' => user_profile["OrgDefinedId"],
|
42
|
-
'FirstName' => user_profile["FirstName"],
|
43
|
-
'MiddleName' => user_profile["MiddleName"],
|
44
|
-
'LastName' => user_profile["LastName"], # Changed previously
|
45
|
-
'ExternalEmail' => user_profile["ExternalEmail"],
|
46
|
-
'UserName' => user_profile["UserName"],
|
47
|
-
'Activation' =>
|
48
|
-
{
|
49
|
-
'IsActive' => user_profile["Activation"]["IsActive"]
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
# Debug code
|
54
|
-
puts "New User Data: \n" if @debug
|
55
|
-
ap new_user_data if @debug
|
56
|
-
|
57
|
-
# Finally update the user's UserData
|
58
|
-
update_user_data(user_profile["UserId"], new_user_data)
|
59
|
-
|
60
|
-
# Check if the user was properly created.
|
61
|
-
if !does_user_exist(user_profile["UserName"])
|
62
|
-
raise "The user's last name was unsuccessfully updated."
|
63
|
-
else
|
64
|
-
puts "The username was successfully updated to: '#{user_profile["UserName"]}'."
|
65
|
-
end
|