Skip to content

Commit 2469c52

Browse files
committed
Split apart examples
1 parent cb86dbf commit 2469c52

File tree

2 files changed

+36
-25
lines changed

2 files changed

+36
-25
lines changed

examples/create_user.rb

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
require 'fusionauth/fusionauth_client'
2+
require 'securerandom'
3+
4+
# Construct the FusionAuth Client
5+
client = FusionAuth::FusionAuthClient.new(
6+
'APIKEY',
7+
'http://localhost:9011'
8+
)
9+
10+
application_id = '20ce6dac-b985-4c77-bb59-6369249f884b'
11+
12+
# Create a user + registration
13+
id = SecureRandom.uuid
14+
response = client.register(id, {
15+
:user => {
16+
:firstName => 'Ruby',
17+
:lastName => 'Client',
18+
:email => 'ruby.client.test@fusionauth.io',
19+
:password => 'password'
20+
},
21+
:registration => {
22+
:applicationId => application_id,
23+
:data => {
24+
:foo => 'bar'
25+
},
26+
:preferredLanguages => %w(en fr),
27+
:roles => %w(user)
28+
}
29+
})
30+
31+
unless response.success_response
32+
print response.error_response
33+
exit
34+
end
35+

examples/login.rb

+1-25
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,7 @@
99

1010
application_id = '20ce6dac-b985-4c77-bb59-6369249f884b'
1111

12-
# Create a user + registration
13-
id = SecureRandom.uuid
14-
response = client.register(id, {
15-
:user => {
16-
:firstName => 'Ruby',
17-
:lastName => 'Client',
18-
:email => 'ruby.client.test@fusionauth.io',
19-
:password => 'password'
20-
},
21-
:registration => {
22-
:applicationId => application_id,
23-
:data => {
24-
:foo => 'bar'
25-
},
26-
:preferredLanguages => %w(en fr),
27-
:roles => %w(user)
28-
}
29-
})
30-
31-
unless response.success_response
32-
print response.error_response
33-
exit
34-
end
35-
36-
# Authenticate the user
12+
# Authenticate a user
3713
response = client.login({
3814
:loginId => 'ruby.client.test@fusionauth.io',
3915
:password => 'password',

0 commit comments

Comments
 (0)