Skip to content

Commit 35f868a

Browse files
committed
merge in develop
2 parents 4d34c94 + 773cb6d commit 35f868a

File tree

6 files changed

+144
-124
lines changed

6 files changed

+144
-124
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ on:
66
- develop
77
- main
88
pull_request:
9-
branches:
10-
- develop
11-
- main
129
workflow_dispatch:
1310

1411
permissions:

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
fusionauth_client (1.59.0)
4+
fusionauth_client (1.60.0)
55

66
GEM
77
remote: https://rubygems.org/

build.savant

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
pubVersion = ""
18-
project(group: "io.fusionauth", name: "fusionauth-ruby-client", version: "1.59.0", licenses: ["ApacheV2_0"]) {
18+
project(group: "io.fusionauth", name: "fusionauth-ruby-client", version: "1.60.0", licenses: ["ApacheV2_0"]) {
1919
workflow {
2020
fetch {
2121
cache()

fusionauth-ruby-client.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<orderEntry type="jdk" jdkName="rbenv: 3.4.2" jdkType="RUBY_SDK" />
1010
<orderEntry type="sourceFolder" forTests="false" />
1111
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.6.2, rbenv: 3.4.2) [gem]" level="application" />
12-
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.25.5, rbenv: 3.4.2) [gem]" level="application" />
1312
<orderEntry type="library" scope="PROVIDED" name="racc (v1.8.1, rbenv: 3.4.2) [gem]" level="application" />
13+
<orderEntry type="library" scope="PROVIDED" name="rake (v13.2.1, rbenv: 3.4.2) [gem]" level="application" />
1414
</component>
1515
</module>

fusionauth_client.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
1919

2020
Gem::Specification.new do |spec|
2121
spec.name = 'fusionauth_client'
22-
spec.version = '1.59.0'
22+
spec.version = '1.60.0'
2323
spec.authors = ['Brian Pontarelli', 'Daniel DeGroff']
2424
2525

test/fusionauth/fusionauth_client_test.rb

Lines changed: 140 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2024, FusionAuth, All Rights Reserved
1+
# Copyright (c) 2024-2025, FusionAuth, All Rights Reserved
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -33,22 +33,22 @@ def test_application_crud
3333
id = SecureRandom.uuid
3434
client = FusionAuth::FusionAuthClient.new(@fusionauthApiKey, @fusionauthUrl)
3535
response = client.create_application(id, {
36-
:application => {
37-
:name => 'Test application',
38-
:roles => [
39-
{
40-
:isDefault => false,
41-
:name => 'admin',
42-
:isSuperRole => true,
43-
:description => 'Admin role'
44-
},
45-
{
46-
:isDefault => true,
47-
:name => 'user',
48-
:description => 'User role'
49-
}
50-
]
51-
}
36+
:application => {
37+
:name => 'Test application',
38+
:roles => [
39+
{
40+
:isDefault => false,
41+
:name => 'admin',
42+
:isSuperRole => true,
43+
:description => 'Admin role'
44+
},
45+
{
46+
:isDefault => true,
47+
:name => 'user',
48+
:description => 'User role'
49+
}
50+
]
51+
}
5252
})
5353
handle_response(response)
5454
assert_equal 'Test application', response.success_response.application.name
@@ -57,11 +57,11 @@ def test_application_crud
5757

5858
# Create a new role
5959
role_response = client.create_application_role(id, nil, {
60-
:role => {
61-
:isDefault => true,
62-
:name => 'new role',
63-
:description => 'New role description'
64-
}
60+
:role => {
61+
:isDefault => true,
62+
:name => 'new role',
63+
:description => 'New role description'
64+
}
6565
})
6666
handle_response(role_response)
6767
application_role = role_response.success_response
@@ -73,11 +73,11 @@ def test_application_crud
7373

7474
# Update the role
7575
client.update_application_role(id, application_role.role.id, {
76-
:role => {
77-
:isDefault => false,
78-
:name => 'new role',
79-
:description => 'New role description'
80-
}
76+
:role => {
77+
:isDefault => false,
78+
:name => 'new role',
79+
:description => 'New role description'
80+
}
8181
})
8282
handle_response(response)
8383
response = client.retrieve_application(id)
@@ -123,17 +123,17 @@ def test_email_template_crud
123123

124124
# Create the email template
125125
response = client.create_email_template(id, {
126-
:emailTemplate => {
127-
:defaultFromName => 'Dude',
128-
:defaultHtmlTemplate => 'HTML Template',
129-
:defaultSubject => 'Subject',
130-
:defaultTextTemplate => 'Text Template',
131-
:fromEmail => '[email protected]',
132-
:localizedFromNames => {
133-
:fr => 'From fr'
134-
},
135-
:name => 'Test Template'
136-
}
126+
:emailTemplate => {
127+
:defaultFromName => 'Dude',
128+
:defaultHtmlTemplate => 'HTML Template',
129+
:defaultSubject => 'Subject',
130+
:defaultTextTemplate => 'Text Template',
131+
:fromEmail => '[email protected]',
132+
:localizedFromNames => {
133+
:fr => 'From fr'
134+
},
135+
:name => 'Test Template'
136+
}
137137
})
138138
handle_response(response)
139139

@@ -144,17 +144,17 @@ def test_email_template_crud
144144

145145
# Update the email tempalte
146146
response = client.update_email_template(id, {
147-
:emailTemplate => {
148-
:defaultFromName => 'Dude',
149-
:defaultHtmlTemplate => 'HTML Template',
150-
:defaultSubject => 'Subject',
151-
:defaultTextTemplate => 'Text Template',
152-
:fromEmail => '[email protected]',
153-
:localizedFromNames => {
154-
:fr => 'From fr'
155-
},
156-
:name => 'Test Template updated'
157-
}
147+
:emailTemplate => {
148+
:defaultFromName => 'Dude',
149+
:defaultHtmlTemplate => 'HTML Template',
150+
:defaultSubject => 'Subject',
151+
:defaultTextTemplate => 'Text Template',
152+
:fromEmail => '[email protected]',
153+
:localizedFromNames => {
154+
:fr => 'From fr'
155+
},
156+
:name => 'Test Template updated'
157+
}
158158
})
159159
handle_response(response)
160160
response = client.retrieve_email_template(id)
@@ -163,20 +163,20 @@ def test_email_template_crud
163163

164164
# Preview it
165165
response = client.retrieve_email_template_preview(
166-
{
167-
:emailTemplate => {
168-
:defaultFromName => 'Dude',
169-
:defaultHtmlTemplate => 'HTML Template',
170-
:defaultSubject => 'Subject',
171-
:defaultTextTemplate => 'Text Template',
172-
:fromEmail => '[email protected]',
173-
:localizedFromNames => {
174-
:fr => 'From fr'
175-
},
176-
:name => 'Test Template updated'
177-
},
178-
:locale => 'fr'
179-
}
166+
{
167+
:emailTemplate => {
168+
:defaultFromName => 'Dude',
169+
:defaultHtmlTemplate => 'HTML Template',
170+
:defaultSubject => 'Subject',
171+
:defaultTextTemplate => 'Text Template',
172+
:fromEmail => '[email protected]',
173+
:localizedFromNames => {
174+
:fr => 'From fr'
175+
},
176+
:name => 'Test Template updated'
177+
},
178+
:locale => 'fr'
179+
}
180180
)
181181
handle_response(response)
182182
assert_equal 'From fr', response.success_response.email.from['display'] # Display is a reserved method in Object in Ruby
@@ -191,15 +191,19 @@ def test_email_template_crud
191191
def test_user_crud
192192
id = SecureRandom.uuid
193193
client = FusionAuth::FusionAuthClient.new(@fusionauthApiKey, @fusionauthUrl)
194-
194+
# cleanup if we have already run
195+
response = client.retrieve_user_by_login_id('[email protected]')
196+
unless response.status == 404
197+
client.delete_user(response.success_response.user.id)
198+
end
195199
# Create a user
196200
response = client.create_user(id, {
197-
:user => {
198-
:firstName => 'Ruby',
199-
:lastName => 'Client',
200-
:email => '[email protected]',
201-
:password => 'password'
202-
}
201+
:user => {
202+
:firstName => 'Ruby',
203+
:lastName => 'Client',
204+
:email => '[email protected]',
205+
:password => 'password'
206+
}
203207
})
204208
handle_response(response)
205209

@@ -210,14 +214,33 @@ def test_user_crud
210214
puts response.status
211215
assert_equal '[email protected]', response.success_response.user.email
212216

217+
# Retrieve the user by loginId
218+
response = client.retrieve_user_by_login_id('[email protected]')
219+
handle_response(response)
220+
puts response.was_successful
221+
puts response.status
222+
assert_equal '[email protected]', response.success_response.user.email
223+
224+
# Retrieve the user by loginId with explicit login_id_types
225+
response = client.retrieve_user_by_login_id_with_login_id_types('[email protected]', ['email'])
226+
handle_response(response)
227+
puts response.was_successful
228+
puts response.status
229+
assert_equal '[email protected]', response.success_response.user.email
230+
231+
# Retrieve the user by loginId with explicit login_id_types (does not match)
232+
# TODO: Once issue 1 is released, this should work
233+
# response = client.retrieve_user_by_login_id_with_login_id_types('[email protected]', ['phoneNumber'])
234+
# assert_equal 404, response.status
235+
213236
# Update the user
214237
response = client.update_user(id, {
215-
:user => {
216-
:firstName => 'Ruby updated',
217-
:lastName => 'Client updated',
218-
:email => '[email protected]',
219-
:password => 'password updated'
220-
}
238+
:user => {
239+
:firstName => 'Ruby updated',
240+
:lastName => 'Client updated',
241+
:email => '[email protected]',
242+
:password => 'password updated'
243+
}
221244
})
222245
handle_response(response)
223246
assert_equal '[email protected]', response.success_response.user.email
@@ -268,50 +291,50 @@ def test_user_registration_crud_and_login
268291

269292
# Create an application
270293
response = client.create_application(application_id, {
271-
:application => {
272-
:name => 'Test application',
273-
:roles => [
274-
{
275-
:isDefault => false,
276-
:name => 'admin',
277-
:isSuperRole => true,
278-
:description => 'Admin role'
279-
},
280-
{
281-
:isDefault => true,
282-
:name => 'user',
283-
:description => 'User role'
284-
}
285-
]
286-
}
294+
:application => {
295+
:name => 'Test application',
296+
:roles => [
297+
{
298+
:isDefault => false,
299+
:name => 'admin',
300+
:isSuperRole => true,
301+
:description => 'Admin role'
302+
},
303+
{
304+
:isDefault => true,
305+
:name => 'user',
306+
:description => 'User role'
307+
}
308+
]
309+
}
287310
})
288311
handle_response(response)
289312

290313
# Create a user + registration
291314
response = client.register(id, {
292-
:user => {
293-
:firstName => 'Ruby',
294-
:lastName => 'Client',
295-
:email => '[email protected]',
296-
:password => 'password'
315+
:user => {
316+
:firstName => 'Ruby',
317+
:lastName => 'Client',
318+
:email => '[email protected]',
319+
:password => 'password'
320+
},
321+
:registration => {
322+
:applicationId => application_id,
323+
:data => {
324+
:foo => 'bar'
297325
},
298-
:registration => {
299-
:applicationId => application_id,
300-
:data => {
301-
:foo => 'bar'
302-
},
303-
:preferredLanguages => %w(en fr),
304-
:roles => %w(user)
305-
}
326+
:preferredLanguages => %w(en fr),
327+
:roles => %w(user)
328+
}
306329
})
307330
handle_response(response)
308331

309332
# Authenticate the user
310333
response = client.login({
311-
:loginId => '[email protected]',
312-
:password => 'password',
313-
:applicationId => application_id
314-
})
334+
:loginId => '[email protected]',
335+
:password => 'password',
336+
:applicationId => application_id
337+
})
315338
handle_response(response)
316339
assert_equal '[email protected]', response.success_response.user.email
317340

@@ -323,14 +346,14 @@ def test_user_registration_crud_and_login
323346

324347
# Update the registration
325348
response = client.update_registration(id, {
326-
:registration => {
327-
:applicationId => application_id,
328-
:data => {
329-
:foo => 'bar updated'
330-
},
331-
:preferredLanguages => %w(en fr),
332-
:roles => %w(admin)
333-
}
349+
:registration => {
350+
:applicationId => application_id,
351+
:data => {
352+
:foo => 'bar updated'
353+
},
354+
:preferredLanguages => %w(en fr),
355+
:roles => %w(admin)
356+
}
334357
})
335358
handle_response(response)
336359
assert_equal 'admin', response.success_response.registration.roles[0]

0 commit comments

Comments
 (0)