clerk-sdk-ruby 2.11.0 → 3.0.0
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 +4 -4
- data/CHANGELOG.md +19 -2
- data/CODEOWNERS +1 -1
- data/Gemfile.lock +2 -2
- data/lib/clerk/authenticatable.rb +10 -1
- data/lib/clerk/rack_middleware_v2.rb +18 -3
- data/lib/clerk/resources.rb +0 -1
- data/lib/clerk/sdk.rb +4 -9
- data/lib/clerk/version.rb +1 -1
- metadata +2 -3
- data/lib/clerk/resources/sms_messages.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c386b9f44d3be850ca0ba0f3bdf5ed2322398fcbd3be2caab4861b5a771f9776
|
4
|
+
data.tar.gz: b82ba95db218bab18647077601ba8ffb44b1d194e6c8c6bda27140fa7d7b979c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ecddaacd364b4d63f993da578888bf9ca72c2280c608e36487953f31ee47febddf0abe5a4af850f15cdf51e87c71e6d9280b43f26aa1f44fdfbc7c24a930626
|
7
|
+
data.tar.gz: 7a28d1da8d6a2d212da1ba5b1730ab063baae5a5eeb2c43f5e36c4e828a8cc4d2f1d67f78e470c37bdbc29a0a069b1a0f969ba3b778f388f4f0638699a4812a6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
## unreleased
|
2
2
|
|
3
|
+
## 3.0.0 - 2024-01-09
|
4
|
+
|
5
|
+
Note: this is identical to 2.12.0, which was yanked because it contained a
|
6
|
+
breaking change.
|
7
|
+
|
8
|
+
- feat: Add org role/permission helpers [https://github.com/clerk/clerk-sdk-ruby/pull/40]
|
9
|
+
- changed: drop create sms endpoint [https://github.com/clerk/clerk-sdk-ruby/pull/39]
|
10
|
+
|
11
|
+
## [YANKED] 2.12.0 - 2024-01-09
|
12
|
+
|
13
|
+
- feat: Add org role/permission helpers [https://github.com/clerk/clerk-sdk-ruby/pull/40]
|
14
|
+
- changed: drop create sms endpoint [https://github.com/clerk/clerk-sdk-ruby/pull/39]
|
15
|
+
|
16
|
+
## 2.11.1 - 2023-10-31
|
17
|
+
|
18
|
+
- fix: Properly set Clerk API key (secret) when using Faraday v2 [https://github.com/clerkinc/clerk-sdk-ruby/pull/37]
|
19
|
+
|
3
20
|
## 2.11.0 - 2023-10-27
|
4
21
|
|
5
22
|
- feat: Added support for Faraday v2 [https://github.com/clerkinc/clerk-sdk-ruby/pull/37]
|
@@ -74,12 +91,12 @@ Identical to 2.9.0.beta3
|
|
74
91
|
|
75
92
|
## 2.0.0 - 2021-10-21
|
76
93
|
|
77
|
-
This release introduces the new networkless middleware which works with the new
|
94
|
+
This release introduces the new networkless middleware which works with the new
|
78
95
|
authentication scheme, [Auth v2](https://clerk.com/docs/upgrade-guides/auth-v2).
|
79
96
|
|
80
97
|
It is backwards-incompatible with applications using Auth v1.
|
81
98
|
|
82
|
-
- [BREAKING]: In order to use this version, you must set the authVersion prop
|
99
|
+
- [BREAKING]: In order to use this version, you must set the authVersion prop
|
83
100
|
accordingly in your frontend: `Clerk.load({authVersion: 2})`
|
84
101
|
|
85
102
|
For more information on Auth v2, please refer to
|
data/CODEOWNERS
CHANGED
@@ -1 +1 @@
|
|
1
|
-
* @clerkinc/backend
|
1
|
+
* @clerkinc/backend
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
clerk-sdk-ruby (2.
|
4
|
+
clerk-sdk-ruby (2.11.1)
|
5
5
|
concurrent-ruby (~> 1.1)
|
6
6
|
faraday (>= 1.4.1, < 3.0)
|
7
7
|
jwt (~> 2.5)
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
faraday-net_http (3.0.2)
|
20
20
|
jwt (2.7.1)
|
21
21
|
minitest (5.20.0)
|
22
|
-
rake (13.0
|
22
|
+
rake (13.1.0)
|
23
23
|
ruby2_keywords (0.0.5)
|
24
24
|
timecop (0.9.8)
|
25
25
|
|
@@ -61,6 +61,14 @@ module Clerk
|
|
61
61
|
request.env["clerk"].org_id
|
62
62
|
end
|
63
63
|
|
64
|
+
def clerk_organization_role
|
65
|
+
request.env["clerk"].org_role
|
66
|
+
end
|
67
|
+
|
68
|
+
def clerk_organization_permissions
|
69
|
+
request.env["clerk"].org_permissions
|
70
|
+
end
|
71
|
+
|
64
72
|
def clerk_user_signed_in?
|
65
73
|
!!clerk_verified_session_claims
|
66
74
|
end
|
@@ -82,7 +90,8 @@ module Clerk
|
|
82
90
|
:clerk_verified_session_claims, :clerk_verified_session_token,
|
83
91
|
:clerk_user, :clerk_user_id, :clerk_user_signed_in?, :clerk_sign_in_url,
|
84
92
|
:clerk_sign_up_url, :clerk_user_profile_url,
|
85
|
-
:clerk_organization, :clerk_organization_id
|
93
|
+
:clerk_organization, :clerk_organization_id, :clerk_organization_role,
|
94
|
+
:clerk_organization_permissions
|
86
95
|
end
|
87
96
|
end
|
88
97
|
end
|
@@ -48,6 +48,18 @@ module Clerk
|
|
48
48
|
@session_claims["org_id"]
|
49
49
|
end
|
50
50
|
|
51
|
+
def org_role
|
52
|
+
return nil if @session_claims.nil?
|
53
|
+
|
54
|
+
@session_claims["org_role"]
|
55
|
+
end
|
56
|
+
|
57
|
+
def org_permissions
|
58
|
+
return nil if @session_claims.nil?
|
59
|
+
|
60
|
+
@session_claims["org_permissions"]
|
61
|
+
end
|
62
|
+
|
51
63
|
private
|
52
64
|
|
53
65
|
def fetch_user(user_id)
|
@@ -203,12 +215,15 @@ module Clerk
|
|
203
215
|
end
|
204
216
|
|
205
217
|
def development_or_staging?
|
206
|
-
Clerk.configuration.api_key
|
207
|
-
|
218
|
+
Clerk.configuration.api_key &&
|
219
|
+
(Clerk.configuration.api_key.start_with?("test_") ||
|
220
|
+
Clerk.configuration.api_key.start_with?("sk_test_"))
|
208
221
|
end
|
209
222
|
|
210
223
|
def production?
|
211
|
-
|
224
|
+
Clerk.configuration.api_key &&
|
225
|
+
(Clerk.configuration.api_key.start_with?("live_") ||
|
226
|
+
Clerk.configuration.api_key.start_with?("sk_live_"))
|
212
227
|
end
|
213
228
|
|
214
229
|
def cross_origin_request?(req)
|
data/lib/clerk/resources.rb
CHANGED
@@ -6,6 +6,5 @@ require_relative "resources/emails"
|
|
6
6
|
require_relative "resources/organizations"
|
7
7
|
require_relative "resources/phone_numbers"
|
8
8
|
require_relative "resources/sessions"
|
9
|
-
require_relative "resources/sms_messages"
|
10
9
|
require_relative "resources/users"
|
11
10
|
require_relative "resources/jwks"
|
data/lib/clerk/sdk.rb
CHANGED
@@ -15,7 +15,6 @@ require_relative "resources/emails"
|
|
15
15
|
require_relative "resources/organizations"
|
16
16
|
require_relative "resources/phone_numbers"
|
17
17
|
require_relative "resources/sessions"
|
18
|
-
require_relative "resources/sms_messages"
|
19
18
|
require_relative "resources/users"
|
20
19
|
require_relative "resources/users"
|
21
20
|
require_relative "resources/jwks"
|
@@ -52,10 +51,10 @@ module Clerk
|
|
52
51
|
URI(base_url)
|
53
52
|
end
|
54
53
|
|
55
|
-
api_key ||=
|
56
|
-
|
57
|
-
|
58
|
-
-> { raise ArgumentError, "Clerk secret key is not set" }
|
54
|
+
api_key ||= Clerk.configuration.api_key
|
55
|
+
|
56
|
+
if Faraday::VERSION.to_i >= 2 && api_key.nil?
|
57
|
+
api_key = -> { raise ArgumentError, "Clerk secret key is not set" }
|
59
58
|
end
|
60
59
|
|
61
60
|
logger = logger || Clerk.configuration.logger
|
@@ -148,10 +147,6 @@ module Clerk
|
|
148
147
|
Resources::Sessions.new(self)
|
149
148
|
end
|
150
149
|
|
151
|
-
def sms_messages
|
152
|
-
Resources::SMSMessages.new(self)
|
153
|
-
end
|
154
|
-
|
155
150
|
def users
|
156
151
|
Resources::Users.new(self)
|
157
152
|
end
|
data/lib/clerk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clerk-sdk-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clerk
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -126,7 +126,6 @@ files:
|
|
126
126
|
- lib/clerk/resources/plural_resource.rb
|
127
127
|
- lib/clerk/resources/sessions.rb
|
128
128
|
- lib/clerk/resources/singular_resource.rb
|
129
|
-
- lib/clerk/resources/sms_messages.rb
|
130
129
|
- lib/clerk/resources/users.rb
|
131
130
|
- lib/clerk/sdk.rb
|
132
131
|
- lib/clerk/utils.rb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require "forwardable"
|
2
|
-
require_relative "plural_resource"
|
3
|
-
|
4
|
-
module Clerk
|
5
|
-
module Resources
|
6
|
-
class SMSMessages
|
7
|
-
extend Forwardable
|
8
|
-
|
9
|
-
def initialize(client)
|
10
|
-
@resource = PluralResource.new(client, "sms_messages")
|
11
|
-
end
|
12
|
-
|
13
|
-
def_delegators :@resource, :create
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|