fusionauth_client 1.15.2 → 1.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/Gemfile +16 -2
- data/README.md +3 -3
- data/build.savant +1 -1
- data/fusionauth-ruby-client.iml +4 -4
- data/fusionauth_client.gemspec +1 -1
- data/lib/fusionauth/fusionauth_client.rb +210 -9
- data/lib/fusionauth/rest_client.rb +15 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 21109a2d8e1bd5cb1229077c02415245b6f04574e91f05240cce4ad5900eb0eb
|
4
|
+
data.tar.gz: 971f1406ab820d744161bebaf1d427c665963789dd129bac32b092c05d8816ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be173c20a7f84ce6c0155c6a6d3cbcdfc7114fde73b7698bbc61f3fa18731a55db4418ca8c2a42efa50b9bacda58726d0668d724bcdc6bac87ec8741dfcca3a4
|
7
|
+
data.tar.gz: 5c3f0faa5560a56daf6a4ee2bee68c448896ee529fab405507a258669f99d3a91e0430c12056ed76d9345978b5ff62db47243931e683769d041a7be82864dd7b
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.1
|
data/Gemfile
CHANGED
@@ -1,7 +1,21 @@
|
|
1
|
+
# Copyright (c) 2019, FusionAuth, All Rights Reserved
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing,
|
10
|
+
# software distributed under the License is distributed on an
|
11
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
12
|
+
# either express or implied. See the License for the specific
|
13
|
+
# language governing permissions and limitations under the License.
|
14
|
+
|
1
15
|
source 'https://rubygems.org'
|
2
|
-
ruby '2.
|
16
|
+
ruby '2.5.1'
|
3
17
|
|
4
|
-
gem "rake", "
|
18
|
+
gem "rake", "12.3.3"
|
5
19
|
gem "minitest", "5.8.3"
|
6
20
|
|
7
21
|
# Specify your gem's dependencies in fusionauth_client.gemspec
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ client = FusionAuth::FusionAuthClient.new(
|
|
33
33
|
|
34
34
|
# Create a user + registration
|
35
35
|
id = SecureRandom.uuid
|
36
|
-
client.register
|
36
|
+
client.register(id, {
|
37
37
|
:user => {
|
38
38
|
:firstName => 'Ruby',
|
39
39
|
:lastName => 'Client',
|
@@ -51,12 +51,12 @@ client.register!(id, {
|
|
51
51
|
})
|
52
52
|
|
53
53
|
# Authenticate the user
|
54
|
-
response = client.login
|
54
|
+
response = client.login({
|
55
55
|
:loginId => 'ruby.client.test@fusionauth.io',
|
56
56
|
:password => 'password',
|
57
57
|
:applicationId => application_id
|
58
58
|
})
|
59
|
-
user = response.user
|
59
|
+
user = response.success.response.user
|
60
60
|
```
|
61
61
|
|
62
62
|
## Contributing
|
data/build.savant
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
savantVersion = "1.0.0"
|
17
17
|
|
18
18
|
pubVersion = ""
|
19
|
-
project(group: "io.fusionauth", name: "fusionauth-ruby-client", version: "1.
|
19
|
+
project(group: "io.fusionauth", name: "fusionauth-ruby-client", version: "1.18.0", licenses: ["ApacheV2_0"]) {
|
20
20
|
workflow {
|
21
21
|
standard()
|
22
22
|
}
|
data/fusionauth-ruby-client.iml
CHANGED
@@ -6,10 +6,10 @@
|
|
6
6
|
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
|
7
7
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
8
8
|
</content>
|
9
|
-
<orderEntry type="jdk" jdkName="rbenv: 2.
|
9
|
+
<orderEntry type="jdk" jdkName="rbenv: 2.5.1" jdkType="RUBY_SDK" />
|
10
10
|
<orderEntry type="sourceFolder" forTests="false" />
|
11
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.
|
12
|
-
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.8.3, rbenv: 2.
|
13
|
-
<orderEntry type="library" scope="PROVIDED" name="rake (
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, rbenv: 2.5.1) [gem]" level="application" />
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.8.3, rbenv: 2.5.1) [gem]" level="application" />
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v12.3.3, rbenv: 2.5.1) [gem]" level="application" />
|
14
14
|
</component>
|
15
15
|
</module>
|
data/fusionauth_client.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'fusionauth_client'
|
7
|
-
spec.version = '1.
|
7
|
+
spec.version = '1.18.0'
|
8
8
|
spec.authors = ['Brian Pontarelli', 'Daniel DeGroff']
|
9
9
|
spec.email = %w(brian@fusionauth.io daniel@fusionauth.io)
|
10
10
|
|
@@ -43,16 +43,13 @@ module FusionAuth
|
|
43
43
|
|
44
44
|
#
|
45
45
|
# Takes an action on a user. The user being actioned is called the "actionee" and the user taking the action is called the
|
46
|
-
# "actioner". Both user ids are required
|
47
|
-
# request object.
|
46
|
+
# "actioner". Both user ids are required in the request object.
|
48
47
|
#
|
49
|
-
# @param actionee_user_id [string] The actionee's user id.
|
50
48
|
# @param request [OpenStruct, Hash] The action request that includes all of the information about the action being taken including
|
51
49
|
# the id of the action, any options and the duration (if applicable).
|
52
50
|
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
53
|
-
def action_user(
|
51
|
+
def action_user(request)
|
54
52
|
start.uri('/api/user/action')
|
55
|
-
.url_segment(actionee_user_id)
|
56
53
|
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
57
54
|
.post()
|
58
55
|
.go()
|
@@ -173,6 +170,20 @@ module FusionAuth
|
|
173
170
|
.go()
|
174
171
|
end
|
175
172
|
|
173
|
+
#
|
174
|
+
# Creates a connector. You can optionally specify an Id for the connector, if not provided one will be generated.
|
175
|
+
#
|
176
|
+
# @param connector_id [string] (Optional) The Id for the connector. If not provided a secure random UUID will be generated.
|
177
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the connector.
|
178
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
179
|
+
def create_connector(connector_id, request)
|
180
|
+
start.uri('/api/connector')
|
181
|
+
.url_segment(connector_id)
|
182
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
183
|
+
.post()
|
184
|
+
.go()
|
185
|
+
end
|
186
|
+
|
176
187
|
#
|
177
188
|
# Creates a user consent type. You can optionally specify an Id for the consent type, if not provided one will be generated.
|
178
189
|
#
|
@@ -216,6 +227,34 @@ module FusionAuth
|
|
216
227
|
.go()
|
217
228
|
end
|
218
229
|
|
230
|
+
#
|
231
|
+
# Creates a form. You can optionally specify an Id for the form, if not provided one will be generated.
|
232
|
+
#
|
233
|
+
# @param form_id [string] (Optional) The Id for the form. If not provided a secure random UUID will be generated.
|
234
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the form.
|
235
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
236
|
+
def create_form(form_id, request)
|
237
|
+
start.uri('/api/form')
|
238
|
+
.url_segment(form_id)
|
239
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
240
|
+
.post()
|
241
|
+
.go()
|
242
|
+
end
|
243
|
+
|
244
|
+
#
|
245
|
+
# Creates a form field. You can optionally specify an Id for the form, if not provided one will be generated.
|
246
|
+
#
|
247
|
+
# @param field_id [string] (Optional) The Id for the form field. If not provided a secure random UUID will be generated.
|
248
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the form field.
|
249
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
250
|
+
def create_form_field(field_id, request)
|
251
|
+
start.uri('/api/form/field')
|
252
|
+
.url_segment(field_id)
|
253
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
254
|
+
.post()
|
255
|
+
.go()
|
256
|
+
end
|
257
|
+
|
219
258
|
#
|
220
259
|
# Creates a group. You can optionally specify an Id for the group, if not provided one will be generated.
|
221
260
|
#
|
@@ -467,6 +506,18 @@ module FusionAuth
|
|
467
506
|
.go()
|
468
507
|
end
|
469
508
|
|
509
|
+
#
|
510
|
+
# Deletes the connector for the given Id.
|
511
|
+
#
|
512
|
+
# @param connector_id [string] The Id of the connector to delete.
|
513
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
514
|
+
def delete_connector(connector_id)
|
515
|
+
start.uri('/api/connector')
|
516
|
+
.url_segment(connector_id)
|
517
|
+
.delete()
|
518
|
+
.go()
|
519
|
+
end
|
520
|
+
|
470
521
|
#
|
471
522
|
# Deletes the consent for the given Id.
|
472
523
|
#
|
@@ -491,6 +542,30 @@ module FusionAuth
|
|
491
542
|
.go()
|
492
543
|
end
|
493
544
|
|
545
|
+
#
|
546
|
+
# Deletes the form for the given Id.
|
547
|
+
#
|
548
|
+
# @param form_id [string] The Id of the form to delete.
|
549
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
550
|
+
def delete_form(form_id)
|
551
|
+
start.uri('/api/form')
|
552
|
+
.url_segment(form_id)
|
553
|
+
.delete()
|
554
|
+
.go()
|
555
|
+
end
|
556
|
+
|
557
|
+
#
|
558
|
+
# Deletes the form field for the given Id.
|
559
|
+
#
|
560
|
+
# @param field_id [string] The Id of the form field to delete.
|
561
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
562
|
+
def delete_form_field(field_id)
|
563
|
+
start.uri('/api/form/field')
|
564
|
+
.url_segment(field_id)
|
565
|
+
.delete()
|
566
|
+
.go()
|
567
|
+
end
|
568
|
+
|
494
569
|
#
|
495
570
|
# Deletes the group for the given Id.
|
496
571
|
#
|
@@ -530,11 +605,11 @@ module FusionAuth
|
|
530
605
|
#
|
531
606
|
# Deletes the key for the given Id.
|
532
607
|
#
|
533
|
-
# @param
|
608
|
+
# @param key_id [string] The Id of the key to delete.
|
534
609
|
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
535
|
-
def delete_key(
|
610
|
+
def delete_key(key_id)
|
536
611
|
start.uri('/api/key')
|
537
|
-
.url_segment(
|
612
|
+
.url_segment(key_id)
|
538
613
|
.delete()
|
539
614
|
.go()
|
540
615
|
end
|
@@ -922,11 +997,15 @@ module FusionAuth
|
|
922
997
|
#
|
923
998
|
# @param application_id [string] The Application Id for which you are requesting a new access token be issued.
|
924
999
|
# @param encoded_jwt [string] The encoded JWT (access token).
|
1000
|
+
# @param refresh_token [string] (Optional) An existing refresh token used to request a refresh token in addition to a JWT in the response.
|
1001
|
+
# <p>The target application represented by the applicationid request parameter must have refresh
|
1002
|
+
# tokens enabled in order to receive a refresh token in the response.</p>
|
925
1003
|
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
926
|
-
def issue_jwt(application_id, encoded_jwt)
|
1004
|
+
def issue_jwt(application_id, encoded_jwt, refresh_token)
|
927
1005
|
start.uri('/api/jwt/issue')
|
928
1006
|
.authorization('JWT ' + encoded_jwt)
|
929
1007
|
.url_parameter('applicationId', application_id)
|
1008
|
+
.url_parameter('refreshToken', refresh_token)
|
930
1009
|
.get()
|
931
1010
|
.go()
|
932
1011
|
end
|
@@ -1054,6 +1133,20 @@ module FusionAuth
|
|
1054
1133
|
.go()
|
1055
1134
|
end
|
1056
1135
|
|
1136
|
+
#
|
1137
|
+
# Updates, via PATCH, the connector with the given Id.
|
1138
|
+
#
|
1139
|
+
# @param connector_id [string] The Id of the connector to update.
|
1140
|
+
# @param request [OpenStruct, Hash] The request that contains just the new connector information.
|
1141
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1142
|
+
def patch_connector(connector_id, request)
|
1143
|
+
start.uri('/api/connector')
|
1144
|
+
.url_segment(connector_id)
|
1145
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1146
|
+
.patch()
|
1147
|
+
.go()
|
1148
|
+
end
|
1149
|
+
|
1057
1150
|
#
|
1058
1151
|
# Updates, via PATCH, the consent with the given Id.
|
1059
1152
|
#
|
@@ -1454,6 +1547,28 @@ module FusionAuth
|
|
1454
1547
|
.go()
|
1455
1548
|
end
|
1456
1549
|
|
1550
|
+
#
|
1551
|
+
# Retrieves the connector with the given Id.
|
1552
|
+
#
|
1553
|
+
# @param connector_id [string] The Id of the connector.
|
1554
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1555
|
+
def retrieve_connector(connector_id)
|
1556
|
+
start.uri('/api/connector')
|
1557
|
+
.url_segment(connector_id)
|
1558
|
+
.get()
|
1559
|
+
.go()
|
1560
|
+
end
|
1561
|
+
|
1562
|
+
#
|
1563
|
+
# Retrieves all of the connectors.
|
1564
|
+
#
|
1565
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1566
|
+
def retrieve_connectors()
|
1567
|
+
start.uri('/api/connector')
|
1568
|
+
.get()
|
1569
|
+
.go()
|
1570
|
+
end
|
1571
|
+
|
1457
1572
|
#
|
1458
1573
|
# Retrieves the Consent for the given Id.
|
1459
1574
|
#
|
@@ -1565,6 +1680,50 @@ module FusionAuth
|
|
1565
1680
|
.go()
|
1566
1681
|
end
|
1567
1682
|
|
1683
|
+
#
|
1684
|
+
# Retrieves the form with the given Id.
|
1685
|
+
#
|
1686
|
+
# @param form_id [string] The Id of the form.
|
1687
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1688
|
+
def retrieve_form(form_id)
|
1689
|
+
start.uri('/api/form')
|
1690
|
+
.url_segment(form_id)
|
1691
|
+
.get()
|
1692
|
+
.go()
|
1693
|
+
end
|
1694
|
+
|
1695
|
+
#
|
1696
|
+
# Retrieves the form field with the given Id.
|
1697
|
+
#
|
1698
|
+
# @param field_id [string] The Id of the form field.
|
1699
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1700
|
+
def retrieve_form_field(field_id)
|
1701
|
+
start.uri('/api/form/field')
|
1702
|
+
.url_segment(field_id)
|
1703
|
+
.get()
|
1704
|
+
.go()
|
1705
|
+
end
|
1706
|
+
|
1707
|
+
#
|
1708
|
+
# Retrieves all of the forms fields
|
1709
|
+
#
|
1710
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1711
|
+
def retrieve_form_fields()
|
1712
|
+
start.uri('/api/form/field')
|
1713
|
+
.get()
|
1714
|
+
.go()
|
1715
|
+
end
|
1716
|
+
|
1717
|
+
#
|
1718
|
+
# Retrieves all of the forms.
|
1719
|
+
#
|
1720
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1721
|
+
def retrieve_forms()
|
1722
|
+
start.uri('/api/form')
|
1723
|
+
.get()
|
1724
|
+
.go()
|
1725
|
+
end
|
1726
|
+
|
1568
1727
|
#
|
1569
1728
|
# Retrieves the group for the given Id.
|
1570
1729
|
#
|
@@ -2466,6 +2625,20 @@ module FusionAuth
|
|
2466
2625
|
.go()
|
2467
2626
|
end
|
2468
2627
|
|
2628
|
+
#
|
2629
|
+
# Updates the connector with the given Id.
|
2630
|
+
#
|
2631
|
+
# @param connector_id [string] The Id of the connector to update.
|
2632
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the new connector information.
|
2633
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
2634
|
+
def update_connector(connector_id, request)
|
2635
|
+
start.uri('/api/connector')
|
2636
|
+
.url_segment(connector_id)
|
2637
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
2638
|
+
.put()
|
2639
|
+
.go()
|
2640
|
+
end
|
2641
|
+
|
2469
2642
|
#
|
2470
2643
|
# Updates the consent with the given Id.
|
2471
2644
|
#
|
@@ -2494,6 +2667,34 @@ module FusionAuth
|
|
2494
2667
|
.go()
|
2495
2668
|
end
|
2496
2669
|
|
2670
|
+
#
|
2671
|
+
# Updates the form with the given Id.
|
2672
|
+
#
|
2673
|
+
# @param form_id [string] The Id of the form to update.
|
2674
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the new form information.
|
2675
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
2676
|
+
def update_form(form_id, request)
|
2677
|
+
start.uri('/api/form')
|
2678
|
+
.url_segment(form_id)
|
2679
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
2680
|
+
.put()
|
2681
|
+
.go()
|
2682
|
+
end
|
2683
|
+
|
2684
|
+
#
|
2685
|
+
# Updates the form field with the given Id.
|
2686
|
+
#
|
2687
|
+
# @param field_id [string] The Id of the form field to update.
|
2688
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the new form field information.
|
2689
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
2690
|
+
def update_form_field(field_id, request)
|
2691
|
+
start.uri('/api/form/field')
|
2692
|
+
.url_segment(field_id)
|
2693
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
2694
|
+
.put()
|
2695
|
+
.go()
|
2696
|
+
end
|
2697
|
+
|
2497
2698
|
#
|
2498
2699
|
# Updates the group with the given Id.
|
2499
2700
|
#
|
@@ -1,3 +1,17 @@
|
|
1
|
+
# Copyright (c) 2019, FusionAuth, All Rights Reserved
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing,
|
10
|
+
# software distributed under the License is distributed on an
|
11
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
12
|
+
# either express or implied. See the License for the specific
|
13
|
+
# language governing permissions and limitations under the License.
|
14
|
+
|
1
15
|
require 'base64'
|
2
16
|
require 'json'
|
3
17
|
require 'net/http'
|
@@ -41,7 +55,7 @@ module FusionAuth
|
|
41
55
|
# @param body_handler [BodyHandler] The body handler.
|
42
56
|
# @return [RESTClient] this
|
43
57
|
#
|
44
|
-
def
|
58
|
+
def body_handler(body_handler)
|
45
59
|
@body_handler = body_handler
|
46
60
|
self
|
47
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fusionauth_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Pontarelli
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-07-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: This library contains the Ruby client library that helps you connect
|
15
15
|
your application to FusionAuth.
|
@@ -51,8 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '0'
|
53
53
|
requirements: []
|
54
|
-
|
55
|
-
rubygems_version: 2.5.1
|
54
|
+
rubygems_version: 3.1.4
|
56
55
|
signing_key:
|
57
56
|
specification_version: 4
|
58
57
|
summary: The Ruby client library for FusionAuth
|