clerk-sdk-ruby 2.5.0 → 2.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f70d13c92fd01f471cd31373b72a5c4aa73784cbc4f8259dff001ed54d6bd5b0
4
- data.tar.gz: 4d63622da821f4bdca7eaff4efa7d698c7666b8068f0de5add37b309e28e9dd6
3
+ metadata.gz: 487a2987f913d5c256ebad719075bbb121af707bc5e2419f12d886f4a7a643f2
4
+ data.tar.gz: 28af474ba5555c26fafb0f64e4969030f0b4fc56ca3df4db3faca0a3855fd5a2
5
5
  SHA512:
6
- metadata.gz: 4ce27dae71ef8f6e6335981041f40881273dc106e06973b288a1c9a089bf35bc03eaa9f561f6c4ca7b21431d7707043365fc77c8306241a85e5e60cd87667d5a
7
- data.tar.gz: 8fc64101a4bde21a7ce0e137b395125554150a48bb7c93b83d595b106be7d0eb92b40d299685e98623f35f022a623bdcf6f2818dacd488d91f600aa32200a899
6
+ metadata.gz: 307f730b9fa19db0e74954e33241f917699af10d876a8314d309366ff43930c7531d204d6c939003b18cee98d4189ffbd56bc8ea12ac1536e4b7d35be68f3057
7
+ data.tar.gz: eef7c69d6d233a80f4c4bbd2df328c9fa3ed74cdfaa0548f1200601d1e632906f403c89e6055698c8e092e9923344202501f742be5a183ea774b59ccaecb9143
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## unreleased
2
2
 
3
+ ## 2.6.0 - 2022-11-01
4
+
5
+ - feat: Implement Organization endpoints [https://github.com/clerkinc/clerk-sdk-ruby/pull/20]
6
+
3
7
  ## 2.5.0 - 2022-09-20
4
8
 
5
9
  - feat: Add support for disabling the middleware on specific routes [https://github.com/clerkinc/clerk-sdk-ruby/pull/19]
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clerk-sdk-ruby (2.4.0)
4
+ clerk-sdk-ruby (2.6.0)
5
5
  faraday (~> 1.4.1)
6
6
  jwt (~> 2.2)
7
7
 
data/README.md CHANGED
@@ -1,26 +1,35 @@
1
- # Clerk Ruby SDK
2
-
1
+ <p align="center">
2
+ <a href="https://www.clerk.dev/?utm_source=github&utm_medium=starter_repos&utm_campaign=sdk_ruby" target="_blank" align="center">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="./docs/clerk-logo-dark.png">
5
+ <img src="./docs/clerk-logo-light.png" height="64">
6
+ </picture>
7
+ </a>
8
+ <br />
9
+ </p>
3
10
 
4
- Thank you for choosing [Clerk](https://clerk.dev/) for your authentication,
5
- session & user management needs!
6
-
7
- This SDK allows you to call the Clerk Backend API from Ruby code without having
8
- to implement the calls yourself.
11
+ # Clerk Ruby SDK
9
12
 
10
- **Note**: You're looking at the main branch, which requires that you use [Auth
11
- v2](https://docs.clerk.dev/main-concepts/auth-v2).
13
+ This SDK allows you to call the [Clerk](https://www.clerk.dev/?utm_source=github&utm_medium=starter_repos&utm_campaign=sdk_ruby) Backend API from Ruby code without having to implement the calls yourself.
12
14
 
13
- If you're looking for the legacy authentication scheme, refer to the
14
- [`v1`](https://github.com/clerkinc/clerk-sdk-ruby/tree/v1) branch.
15
+ [![chat on Discord](https://img.shields.io/discord/856971667393609759.svg?logo=discord)](https://discord.com/invite/b5rXHjAg7A)
16
+ [![documentation](https://img.shields.io/badge/documentation-clerk-green.svg)](https://docs.clerk.dev)
17
+ [![twitter](https://img.shields.io/twitter/follow/ClerkDev?style=social)](https://twitter.com/intent/follow?screen_name=ClerkDev)
15
18
 
16
19
  ---
17
20
 
18
21
  **Clerk is Hiring!**
19
22
 
20
- Would you like to work on Open Source software and help maintain this repository? Apply today https://apply.workable.com/clerk-dev/.
23
+ Would you like to work on Open Source software and help maintain this repository? [Apply today!](https://apply.workable.com/clerk-dev/)
21
24
 
22
25
  ---
23
26
 
27
+ **Note**: You're looking at the main branch, which requires that you use [Auth
28
+ v2](https://clerk.dev/docs/upgrade-guides/auth-v2).
29
+
30
+ If you're looking for the legacy authentication scheme, refer to the
31
+ [`v1`](https://github.com/clerkinc/clerk-sdk-ruby/tree/v1) branch.
32
+
24
33
  ## Installation
25
34
 
26
35
  Add this line to your application's Gemfile:
Binary file
Binary file
@@ -0,0 +1,65 @@
1
+ require "forwardable"
2
+ require_relative "plural_resource"
3
+
4
+ module Clerk
5
+ module Resources
6
+ class Organizations
7
+ extend Forwardable
8
+
9
+ def initialize(client)
10
+ @client = client
11
+ @resource = PluralResource.new(client, "organizations")
12
+ end
13
+
14
+ def_delegators :@resource, :all, :find, :create, :update, :delete
15
+
16
+ #
17
+ # Invitations
18
+ #
19
+ def pending_invitations(org_id, query_params = {})
20
+ @client.request(:get, "#{invitations_path(org_id)}/pending", query: query_params)
21
+ end
22
+
23
+ def create_invitation(org_id, data)
24
+ @client.request(:post, invitations_path(org_id), body: data)
25
+ end
26
+
27
+ def revoke_invitation(org_id, invitation_id, data)
28
+ @client.request(:post, "#{invitations_path(org_id, invitation_id)}/revoke", body: data)
29
+ end
30
+
31
+ #
32
+ # Memberships
33
+ #
34
+ def memberships(org_id, query_params = {})
35
+ @client.request(:get, memberships_path(org_id), query: query_params)
36
+ end
37
+
38
+ def create_membership(org_id, data)
39
+ @client.request(:post, memberships_path(org_id), body: data)
40
+ end
41
+
42
+ def update_membership(org_id, user_id, data)
43
+ @client.request(:patch, memberships_path(org_id, user_id), body: data)
44
+ end
45
+
46
+ def delete_membership(org_id, user_id)
47
+ @client.request(:delete, memberships_path(org_id, user_id))
48
+ end
49
+
50
+ private
51
+
52
+ def invitations_path(org_id, invitation_id=nil)
53
+ path = "#{@resource.resource_path(org_id)}/invitations"
54
+ path << "/#{invitation_id}" if invitation_id
55
+ path
56
+ end
57
+
58
+ def memberships_path(org_id, user_id=nil)
59
+ path = "#{@resource.resource_path(org_id)}/memberships"
60
+ path << "/#{user_id}" if user_id
61
+ path
62
+ end
63
+ end
64
+ end
65
+ end
@@ -24,6 +24,10 @@ module Clerk
24
24
  def disable_mfa(user_id)
25
25
  @client.request(:delete, "#{@resource.resource_path(user_id)}/mfa")
26
26
  end
27
+
28
+ def organization_memberships(user_id, query_params = {})
29
+ @client.request(:get, "#{@resource.resource_path(user_id)}/organization_memberships", query: query_params)
30
+ end
27
31
  end
28
32
  end
29
33
  end
@@ -2,6 +2,7 @@ require_relative "resources/allowlist_identifiers"
2
2
  require_relative "resources/allowlist"
3
3
  require_relative "resources/clients"
4
4
  require_relative "resources/emails"
5
+ require_relative "resources/organizations"
5
6
  require_relative "resources/sessions"
6
7
  require_relative "resources/sms_messages"
7
8
  require_relative "resources/users"
data/lib/clerk/sdk.rb CHANGED
@@ -10,6 +10,7 @@ require_relative "resources/allowlist_identifiers"
10
10
  require_relative "resources/allowlist"
11
11
  require_relative "resources/clients"
12
12
  require_relative "resources/emails"
13
+ require_relative "resources/organizations"
13
14
  require_relative "resources/sessions"
14
15
  require_relative "resources/sms_messages"
15
16
  require_relative "resources/users"
@@ -114,6 +115,10 @@ module Clerk
114
115
  Resources::Emails.new(self)
115
116
  end
116
117
 
118
+ def organizations
119
+ Resources::Organizations.new(self)
120
+ end
121
+
117
122
  def sessions
118
123
  Resources::Sessions.new(self)
119
124
  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 = "2.5.0"
4
+ VERSION = "2.6.0"
5
5
  end
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: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clerk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-20 00:00:00.000000000 Z
11
+ date: 2022-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -84,6 +84,8 @@ files:
84
84
  - bin/console
85
85
  - bin/setup
86
86
  - clerk-sdk-ruby.gemspec
87
+ - docs/clerk-logo-dark.png
88
+ - docs/clerk-logo-light.png
87
89
  - lib/clerk.rb
88
90
  - lib/clerk/authenticatable.rb
89
91
  - lib/clerk/errors.rb
@@ -97,6 +99,7 @@ files:
97
99
  - lib/clerk/resources/clients.rb
98
100
  - lib/clerk/resources/emails.rb
99
101
  - lib/clerk/resources/jwks.rb
102
+ - lib/clerk/resources/organizations.rb
100
103
  - lib/clerk/resources/plural_resource.rb
101
104
  - lib/clerk/resources/sessions.rb
102
105
  - lib/clerk/resources/singular_resource.rb