learnworlds 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/Gemfile.lock +1 -1
- data/README.md +6 -5
- data/lib/learn_worlds/resources/single_sign_on_resource.rb +4 -0
- data/lib/learn_worlds/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 350cb9098ffa9460535ace6d8c8c29988a5a924239c1ab654a682e6a9801f0e4
|
4
|
+
data.tar.gz: f5ba89153ac72c241790d9bab9691c5cb182ee3c92d03dccdb16c1062410192c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71a724e288972dae917f0a1a2ce7e70fe2d83367d19a749a456f54a5a9991015f5ab307a50b26e9f225cfdc18a23ee54c9134573fa3cc1efd045592dbca100d8
|
7
|
+
data.tar.gz: 6f425e3d59b69b148479a2bc21e286000d83ea48d08bcb13a5fa5550b108ca58483367f4e2b484990c8f591a5e41f5da988a567df87ff3719c8004db9db6ef87
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.2.2] - 2022-08-09
|
4
|
+
|
5
|
+
- Add possibility to sso with user id instead of email
|
6
|
+
|
3
7
|
## [0.2.1] - 2022-08-09
|
4
8
|
|
5
9
|
- Add attach and detach methods to the user resource
|
@@ -27,4 +31,3 @@
|
|
27
31
|
- Initial release
|
28
32
|
- Adds a basic structure to aid future developments
|
29
33
|
- Adds methods to interact with the user resource ( list, create, update, find and enroll )
|
30
|
-
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -18,7 +18,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
18
18
|
|
19
19
|
### Authentication with Client Credentials grant
|
20
20
|
|
21
|
-
To authenticate with client credentials grant you need to
|
21
|
+
To authenticate with client credentials grant you need to
|
22
22
|
|
23
23
|
```ruby
|
24
24
|
client = LearnWorlds::Client.new(
|
@@ -42,13 +42,13 @@ client = LearnWorlds::Client.new(
|
|
42
42
|
|
43
43
|
you can also save some lines of code if you set the folloing env vars `LEARN_WORLDS_CLIENT_ID`, `LEARN_WORLDS_CLIENT_SECRET`, `LEARN_WORLDS_BASE_URL`
|
44
44
|
|
45
|
-
Once that is done, you can initialize the client with
|
45
|
+
Once that is done, you can initialize the client with
|
46
46
|
|
47
47
|
```ruby
|
48
48
|
client = LearnWorlds::Client.new
|
49
49
|
```
|
50
50
|
|
51
|
-
Everytime you call `authenticate('client_credentials')` a new request will be made to Learn Worlds.
|
51
|
+
Everytime you call `authenticate('client_credentials')` a new request will be made to Learn Worlds.
|
52
52
|
If you want to avoid that you can define custom getters and setters for the access token via the configuration.
|
53
53
|
|
54
54
|
You can use that to add logic to persist or get the access token on your side and you can also add some logic to verify if the access token is still valid.
|
@@ -57,7 +57,7 @@ For example:
|
|
57
57
|
|
58
58
|
```ruby
|
59
59
|
LearnWorlds.configure do |config|
|
60
|
-
|
60
|
+
|
61
61
|
# return nil if access_token is invalid and you want to proceed with the authentication process
|
62
62
|
config.retrieve_access_token_method = ->() { Rails.cache.fetch("learnworlds_access_token") }
|
63
63
|
|
@@ -97,8 +97,9 @@ client.user.detach_tags(user_id: 'user_id', tags: ['tag1', 'tag2'])
|
|
97
97
|
|
98
98
|
client.sso.redirect(email: 'test@test.com', redirect_to 'xyz.learnworlds.com/courses')
|
99
99
|
|
100
|
-
|
100
|
+
client.sso.redirect_with_id(user_id: 'learnworlds_user_id', redirect_to 'xyz.learnworlds.com/courses')
|
101
101
|
|
102
|
+
```
|
102
103
|
|
103
104
|
## Development
|
104
105
|
|
@@ -5,5 +5,9 @@ module LearnWorlds
|
|
5
5
|
def redirect(email:, redirect_to:)
|
6
6
|
post_request(SSO_ENDPOINT, { email: email, redirectUrl: redirect_to }).body['url']
|
7
7
|
end
|
8
|
+
|
9
|
+
def redirect_with_id(user_id:, redirect_to:)
|
10
|
+
post_request(SSO_ENDPOINT, { user_id: user_id, redirectUrl: redirect_to }).body['url']
|
11
|
+
end
|
8
12
|
end
|
9
13
|
end
|
data/lib/learn_worlds/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: learnworlds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nuno Correia
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|