clerk-sdk-ruby 4.0.0.beta4 → 4.0.0.beta6

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: 37d37c25f76ef78179a59083af8a754d1dbdff353d858cda3ba08ae679497ff8
4
- data.tar.gz: f3d5676522601c297a8a7ba997bb73072aefe5cb387ab0a8e836d991421f61ee
3
+ metadata.gz: aaed5e67ede82680d513f67c5e110f262ecb62af8c9a3cb4cacf4dfcf8a8079a
4
+ data.tar.gz: a8cf3491f982a7d00adaeeb834dffd7d2ab2f7f202ac20327e4b2286a1f38338
5
5
  SHA512:
6
- metadata.gz: 96891456fd52907105030582cb772c28f07a3ca24d16ddd666277df514652314cdaa3ba54ee14e99466789aea996dad74df884ca2a9c0ff6d7ff42d5ad22a404
7
- data.tar.gz: 4512bbdb1d3e6e787adb7fd7dfa39967fef73d6e742fcf0ca5c87f58016e5ed5ed25c3fd32c24dc24997644b388da33ca6da7e1ed028cb61040dec60210bd43c
6
+ metadata.gz: e346a8cb1cacd47bbbf74a1b6ec2c6fd09fecbc64d6a3d61d462390281eea7d05246303d1d63abe924fb3ea1041602f2e1261968606a85d867339c3ae1cc80c6
7
+ data.tar.gz: 3fd4a43f852c79ac82ece2a6fc8c110d0b77258b483f36082e546a1ebdf85ca9bab25a68abce2adf7ff0a93ad42884376676088e53d2a420295d50e606af71b0
@@ -20,6 +20,8 @@ jobs:
20
20
 
21
21
  - name: Set up Ruby
22
22
  uses: ruby/setup-ruby@v1
23
+ env:
24
+ BUNDLE_FROZEN: false
23
25
  with:
24
26
  ruby-version: ${{ matrix.ruby }}
25
27
  bundler-cache: true
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clerk-sdk-ruby (4.0.0.beta4)
5
- clerk-http-client (~> 0.0.1)
4
+ clerk-sdk-ruby (4.0.0.beta6)
5
+ clerk-http-client (= 2.0.0.beta5)
6
6
  concurrent-ruby (~> 1.1)
7
7
  faraday (>= 1.4.1, < 3.0)
8
8
  jwt (~> 2.5)
@@ -45,7 +45,7 @@ GEM
45
45
  bigdecimal (3.1.9)
46
46
  builder (3.3.0)
47
47
  byebug (11.1.3)
48
- clerk-http-client (0.0.1)
48
+ clerk-http-client (2.0.0.beta5)
49
49
  faraday (>= 1.0.1, < 3.0)
50
50
  faraday-multipart
51
51
  marcel
data/README.md CHANGED
@@ -166,10 +166,19 @@ end
166
166
 
167
167
  This gives your controller and views access to the following methods and more:
168
168
 
169
+ - `clerk.sdk.*`
169
170
  - `clerk.session`
170
171
  - `clerk.user`
171
172
  - `clerk.user?`
172
173
 
174
+ ### Skipping the Railtie
175
+
176
+ There are cases where you might not want to use the Railtie, for example, only using the SDK in a Rails application. To accomplish this, you can set the `CLERK_SKIP_RAILTIE` environment variable to `true`.
177
+
178
+ This will prevent the Railtie from being loaded and the Rack middleware from being added to the middleware stack.
179
+
180
+ You can still configure the SDK as normal, but you will need to call the SDK using `Clerk::SDK.new` instead of the `clerk.sdk` helper.
181
+
173
182
  ## Sinatra integration
174
183
 
175
184
  The SDK enables the use of Extensions to add Clerk support to your Sinatra application.
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- clerk-sdk-ruby (4.0.0.beta4)
5
- clerk-http-client (~> 0.0.1)
4
+ clerk-sdk-ruby (4.0.0.beta6)
5
+ clerk-http-client (= 2.0.0.beta5)
6
6
  concurrent-ruby (~> 1.1)
7
7
  faraday (>= 1.4.1, < 3.0)
8
8
  jwt (~> 2.5)
@@ -93,7 +93,7 @@ GEM
93
93
  brakeman (7.0.0)
94
94
  racc
95
95
  builder (3.3.0)
96
- clerk-http-client (0.0.1)
96
+ clerk-http-client (2.0.0.beta5)
97
97
  faraday (>= 1.0.1, < 3.0)
98
98
  faraday-multipart
99
99
  marcel
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- clerk-sdk-ruby (4.0.0.beta4)
5
- clerk-http-client (~> 0.0.1)
4
+ clerk-sdk-ruby (4.0.0.beta6)
5
+ clerk-http-client (= 2.0.0.beta5)
6
6
  concurrent-ruby (~> 1.1)
7
7
  faraday (>= 1.4.1, < 3.0)
8
8
  jwt (~> 2.5)
@@ -105,7 +105,7 @@ GEM
105
105
  rack-test (>= 0.6.3)
106
106
  regexp_parser (>= 1.5, < 3.0)
107
107
  xpath (~> 3.2)
108
- clerk-http-client (0.0.1)
108
+ clerk-http-client (2.0.0.beta5)
109
109
  faraday (>= 1.0.1, < 3.0)
110
110
  faraday-multipart
111
111
  marcel
data/bin/release ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env bash
2
+ set -eo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ # Get the version number from the generated version file
6
+ VERSION=$(ruby -e "require './lib/clerk/version.rb'; puts Clerk::VERSION")
7
+
8
+ echo "Building and releasing version ${VERSION}"
9
+
10
+ # Remove any existing gem files
11
+ rm clerk-sdk-ruby-*.gem || true
12
+
13
+ # Build the gem
14
+ gem build clerk-sdk-ruby.gemspec
15
+
16
+ # Publish to RubyGems
17
+ gem push "clerk-sdk-ruby-${VERSION}.gem"
18
+
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_dependency "faraday", ">= 1.4.1", "< 3.0"
31
31
  spec.add_dependency "jwt", '~> 2.5'
32
- spec.add_dependency "clerk-http-client", "~> 0.0.1"
32
+ spec.add_dependency "clerk-http-client", "2.0.0.beta5"
33
33
  spec.add_dependency "concurrent-ruby", "~> 1.1"
34
34
 
35
35
  spec.add_development_dependency "byebug", "~> 11.1"
@@ -22,7 +22,7 @@ module Clerk
22
22
  @lock.with_write_lock do
23
23
  @last_update = Time.now.to_i
24
24
  @jwks = begin
25
- sdk.jwks.get.keys.map(&:to_hash)
25
+ sdk.jwks.get_jwks.keys.map(&:to_hash)
26
26
  rescue Clerk::Error, ClerkHttpClient::ApiError
27
27
  nil
28
28
  end
data/lib/clerk/proxy.rb CHANGED
@@ -108,13 +108,13 @@ module Clerk
108
108
 
109
109
  def fetch_user(user_id)
110
110
  cached_fetch("clerk:user:#{user_id}") do
111
- sdk.users.find(user_id)
111
+ sdk.users.get_user(user_id)
112
112
  end
113
113
  end
114
114
 
115
115
  def fetch_org(org_id)
116
116
  cached_fetch("clerk:org:#{org_id}") do
117
- sdk.organizations.find(org_id)
117
+ sdk.organizations.get_organization(org_id)
118
118
  end
119
119
  end
120
120
 
data/lib/clerk/rails.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  require "clerk"
2
2
  require "clerk/authenticatable"
3
- require "clerk/railtie"
3
+ require "clerk/railtie" if defined?(Rails::Railtie)
data/lib/clerk/railtie.rb CHANGED
@@ -6,7 +6,9 @@ module Clerk
6
6
  module Rails
7
7
  class Railtie < ::Rails::Railtie
8
8
  initializer "clerk.configure_rails_initialization" do |app|
9
- app.middleware.use Clerk::Rack::Middleware
9
+ unless ENV["CLERK_SKIP_RAILTIE"]
10
+ app.middleware.use Clerk::Rack::Middleware
11
+ end
10
12
  end
11
13
  end
12
14
  end
data/lib/clerk/sdk.rb CHANGED
@@ -43,34 +43,5 @@ module Clerk
43
43
 
44
44
  JWT.decode(token, nil, true, algorithms: algorithms, exp_leeway: timeout, jwks: jwk_loader).first
45
45
  end
46
-
47
- private
48
-
49
- # TODO: Temporary solution until generators are improved
50
- HTTP_CLIENT_CUSTOM_MAPPING = {
51
- allowlist: "AllowListBlockList",
52
- blocklist: "AllowListBlockList",
53
- email_sms_templates: "EmailSMSTemplates",
54
- oauth_applications: "OAuthApplications",
55
- jwt_templates: "JWTTemplates",
56
- redirect_urls: "RedirectURLs",
57
- saml_connections: "SAMLConnections"
58
- }
59
-
60
- def generate_const_name(method_name)
61
- "#{HTTP_CLIENT_CUSTOM_MAPPING[method_name] || Utils.camel_case(method_name)}Api"
62
- end
63
-
64
- def respond_to_missing?(method_name, include_private = false)
65
- ClerkHttpClient.const_get(generate_const_name(method_name)).respond_to?(:new)
66
- rescue NameError
67
- false
68
- end
69
-
70
- def method_missing(method_name, *arguments)
71
- ClerkHttpClient.const_get(generate_const_name(method_name)).new
72
- rescue NameError
73
- raise NoMethodError, "undefined method `#{method_name}` for #{self.class.name}"
74
- end
75
46
  end
76
47
  end
data/lib/clerk/utils.rb CHANGED
@@ -5,12 +5,6 @@ require "base64"
5
5
  module Clerk
6
6
  module Utils
7
7
  class << self
8
- def camel_case(str)
9
- str = str.to_s
10
- return str if str !~ /_/ && str =~ /[A-Z]+.*/
11
- str.split("_").map { |s| s.capitalize }.join
12
- end
13
-
14
8
  def decode_publishable_key(publishable_key)
15
9
  Base64.decode64(publishable_key.split("_")[2].to_s)
16
10
  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 = "4.0.0.beta4"
4
+ VERSION = "4.0.0.beta6"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clerk-sdk-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta4
4
+ version: 4.0.0.beta6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clerk
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-06 00:00:00.000000000 Z
10
+ date: 2025-01-27 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: faraday
@@ -47,16 +47,16 @@ dependencies:
47
47
  name: clerk-http-client
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  requirements:
50
- - - "~>"
50
+ - - '='
51
51
  - !ruby/object:Gem::Version
52
- version: 0.0.1
52
+ version: 2.0.0.beta5
53
53
  type: :runtime
54
54
  prerelease: false
55
55
  version_requirements: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - "~>"
57
+ - - '='
58
58
  - !ruby/object:Gem::Version
59
- version: 0.0.1
59
+ version: 2.0.0.beta5
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: concurrent-ruby
62
62
  requirement: !ruby/object:Gem::Requirement
@@ -277,6 +277,7 @@ files:
277
277
  - apps/sinatra/config.ru
278
278
  - apps/sinatra/views/index.erb
279
279
  - bin/console
280
+ - bin/release
280
281
  - bin/setup
281
282
  - clerk-sdk-ruby.gemspec
282
283
  - docs/clerk-logo-dark.png