clerk-sdk-ruby 1.0.1 → 1.0.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 +15 -0
- data/Gemfile.lock +6 -2
- data/README.md +9 -9
- data/lib/clerk.rb +5 -4
- data/lib/clerk/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cef3c6d803258b6f1e265dad2cd2de936f96c50df20b87cfbf2b925c37ecd443
|
4
|
+
data.tar.gz: d280a0b94a0fa8a89d267a7af6915171c5e4860a21fafad2c400f9c3a1610126
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3784def3d89def58174ee71733119162a4e579ac99ee4b016bbea7d234e28caa71e59d0c74e3cf3b06b557164ed81c9cdb9630d000929656e4cc4dcb16254861
|
7
|
+
data.tar.gz: 0f71e96b2781cdfbade6173cb28f9ea14d6f61b4dcd11014dc95b8baa2d45c660ea4d1c21ff5fa87c1bbb60daff8d6eab1c61d354a8f45be21e282e585390ef3
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
## unreleased
|
2
|
+
|
3
|
+
## 1.0.2 - 2021-06-03
|
4
|
+
|
5
|
+
- fix: Instantiation of `Clerk::SDK` without prior call to `Clerk.configure`
|
6
|
+
|
7
|
+
## 1.0.1 - 2021-06-03
|
8
|
+
|
9
|
+
### enhancements
|
10
|
+
|
11
|
+
- Middleware now uses a proxy object which lazy loads the Clerk session and user only when needed
|
12
|
+
|
13
|
+
## 1.0.0 - 2021-05-27
|
14
|
+
|
15
|
+
- initial release
|
data/Gemfile.lock
CHANGED
@@ -1,18 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
clerk-sdk-ruby (1.0.
|
4
|
+
clerk-sdk-ruby (1.0.2)
|
5
5
|
faraday (~> 1.4.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
faraday (1.4.
|
10
|
+
faraday (1.4.2)
|
11
|
+
faraday-em_http (~> 1.0)
|
12
|
+
faraday-em_synchrony (~> 1.0)
|
11
13
|
faraday-excon (~> 1.1)
|
12
14
|
faraday-net_http (~> 1.0)
|
13
15
|
faraday-net_http_persistent (~> 1.1)
|
14
16
|
multipart-post (>= 1.2, < 3)
|
15
17
|
ruby2_keywords (>= 0.0.4)
|
18
|
+
faraday-em_http (1.0.0)
|
19
|
+
faraday-em_synchrony (1.0.0)
|
16
20
|
faraday-excon (1.1.0)
|
17
21
|
faraday-net_http (1.0.1)
|
18
22
|
faraday-net_http_persistent (1.1.0)
|
data/README.md
CHANGED
@@ -63,10 +63,10 @@ supported configuration settings their environment variable equivalents:
|
|
63
63
|
|
64
64
|
```ruby
|
65
65
|
Clerk.configure do |c|
|
66
|
-
c.api_key = "your_api_key" # if omitted: ENV
|
66
|
+
c.api_key = "your_api_key" # if omitted: ENV["CLERK_API_KEY"] - API calls will fail if unset
|
67
67
|
c.base_url = "https://..." # if omitted: "https://api.clerk.dev/v1/"
|
68
68
|
c.logger = Logger.new(STDOUT) # if omitted, no logging
|
69
|
-
c.middleware_cache_store = ActiveSupport::Cache::FileStore.new("/tmp/clerk_middleware_cache") # if omitted:
|
69
|
+
c.middleware_cache_store = ActiveSupport::Cache::FileStore.new("/tmp/clerk_middleware_cache") # if omitted: no caching
|
70
70
|
end
|
71
71
|
```
|
72
72
|
|
@@ -94,17 +94,17 @@ for details.
|
|
94
94
|
|
95
95
|
## Rack middleware
|
96
96
|
|
97
|
-
The SDK comes with a Rack middleware which
|
98
|
-
|
99
|
-
|
100
|
-
|
97
|
+
The SDK comes with a Rack middleware which lazily loads the Clerk session and
|
98
|
+
user. It inserts a `clerk` key in the Rack environment, which is an instance
|
99
|
+
of `Clerk::Proxy`. To get the session or the user of the session, you call
|
100
|
+
`session` or `user` respectively. In case there is no session, you can retrieve
|
101
|
+
the API error with the `error` getter method.
|
101
102
|
|
102
103
|
## Rails integration
|
103
104
|
|
104
105
|
The SDK will automatically add the [Rack middleware](#rack-middleware) to the
|
105
|
-
middleware stack
|
106
|
-
|
107
|
-
controller:
|
106
|
+
middleware stack. For easier access to the Clerk session and user, include the
|
107
|
+
`Clerk::Authenticatable` concern in your controller:
|
108
108
|
|
109
109
|
```ruby
|
110
110
|
require "clerk/authenticatable"
|
data/lib/clerk.rb
CHANGED
@@ -5,12 +5,13 @@ require_relative "clerk/sdk"
|
|
5
5
|
|
6
6
|
module Clerk
|
7
7
|
class << self
|
8
|
-
attr_accessor :configuration
|
9
|
-
|
10
8
|
def configure
|
11
|
-
self.configuration ||= Config.new
|
12
9
|
yield(configuration)
|
13
10
|
end
|
11
|
+
|
12
|
+
def configuration
|
13
|
+
@configuration ||= Config.new
|
14
|
+
end
|
14
15
|
end
|
15
16
|
|
16
17
|
class Config
|
@@ -19,7 +20,7 @@ module Clerk
|
|
19
20
|
|
20
21
|
def initialize
|
21
22
|
@base_url = ENV.fetch("CLERK_API_BASE", PRODUCTION_BASE_URL)
|
22
|
-
@api_key = ENV
|
23
|
+
@api_key = ENV["CLERK_API_KEY"]
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
data/lib/clerk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clerk-sdk-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clerk
|
@@ -33,6 +33,7 @@ extra_rdoc_files: []
|
|
33
33
|
files:
|
34
34
|
- ".github/workflows/main.yml"
|
35
35
|
- ".gitignore"
|
36
|
+
- CHANGELOG.md
|
36
37
|
- Gemfile
|
37
38
|
- Gemfile.lock
|
38
39
|
- LICENSE.txt
|