clerk-sdk-ruby 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 348624d72466db1c264e0ba1044b4dcda33e1d7327791bc1732266d45a84ca00
4
- data.tar.gz: 1f4732763f8b27000fc55949652bad8d8ed36b54bb52ee8d43c0875b9c61e272
3
+ metadata.gz: cef3c6d803258b6f1e265dad2cd2de936f96c50df20b87cfbf2b925c37ecd443
4
+ data.tar.gz: d280a0b94a0fa8a89d267a7af6915171c5e4860a21fafad2c400f9c3a1610126
5
5
  SHA512:
6
- metadata.gz: de828320ec3e92b3e3d0b5b9f584058fff86fe8b632616fd82af3de5a5398c5459b747262deed243c83319641e5a294d0c01b30bd1714e4711d72007d3b5e722
7
- data.tar.gz: e65292535f0d1fa5a0a01e24d832af97b467c8a563cff73c08eb64b54a9946440c2888bcf18125dbdc7fc7b97404aa69d85bb3e982b1a826567fa7e63affb25a
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.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.1)
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.fetch("CLERK_API_KEY") - will fail if unset
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: Rails.cache or no caching (if not in a Rails app)
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 sets the Clerk session and user in
98
- the Rack environment. The keys are: `clerk_session` and `clerk_user` for the
99
- session and user respectively. If the API responds with an error `clerk_error`
100
- will be set.
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, using `Rails.cache` for its cache. For easier access to the
106
- Clerk session and user, include the `Clerk::Authenticatable` concern in your
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.fetch("CLERK_API_KEY")
23
+ @api_key = ENV["CLERK_API_KEY"]
23
24
  end
24
25
  end
25
26
  end
data/lib/clerk/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Clerk
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
  end
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.1
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