workos 1.5.0 → 1.5.1

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: ae5493072c3719c3a6475116ed51d7955e072fb9499a9a40b231482ffd9db082
4
- data.tar.gz: 451ba6d7ac9542bf9cda07fe9703035fb8d58d0b1e6b4beceb4b6e7273e3b3f6
3
+ metadata.gz: 5aecf9fa40a85a4623e12f1ba6804c87fde006931bed9a443327f6851d714df1
4
+ data.tar.gz: 63d0daa095bf705643906247371d36a15f7ec9aac2b9d5b04293fb7e135a1d57
5
5
  SHA512:
6
- metadata.gz: d5a7b8b11117bf140ee16cd1f390cd4c94cb9dba75c5c1668cc558290a2619e016c6e59f47ae2a13d5483e61078d79731bee619643ca6ec9640464b0e96a3d17
7
- data.tar.gz: 1534875a20f5410c6b9f9a9680cb9da1ad95247308765a3dc8917f3ffde2c2e1535ae56f022051207f69295d678f621a94b8b9f9ac8ea70812ec3f4108d6edef
6
+ metadata.gz: f6c47e8d64139d4e3452dca04e6466b177b8c029b97779e58b93407d5e08f9c886076a0101a9b272376fe33e9ee16c180464e25b3be42a6089b921108187eeb1
7
+ data.tar.gz: 577c4b464439eed2216d1011d637d619cd0af9c69f985f5d56f56ce58f6c72deb71f0d2dc66efc1014daa7d973cd2c1d3e95a2f729627658d4235ce2da683184
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workos (1.5.0)
4
+ workos (1.5.1)
5
5
  sorbet-runtime (~> 0.5)
6
6
 
7
7
  GEM
@@ -60,7 +60,7 @@ GEM
60
60
  simplecov_json_formatter (0.1.2)
61
61
  sorbet (0.5.6388)
62
62
  sorbet-static (= 0.5.6388)
63
- sorbet-runtime (0.5.9035)
63
+ sorbet-runtime (0.5.9094)
64
64
  sorbet-static (0.5.6388-universal-darwin-14)
65
65
  sorbet-static (0.5.6388-universal-darwin-15)
66
66
  sorbet-static (0.5.6388-universal-darwin-16)
data/lib/workos/client.rb CHANGED
@@ -9,12 +9,9 @@ module WorkOS
9
9
 
10
10
  sig { returns(Net::HTTP) }
11
11
  def client
12
- return @client if defined?(@client)
13
-
14
- @client = Net::HTTP.new(WorkOS::API_HOSTNAME, 443)
15
- @client.use_ssl = true
16
-
17
- @client
12
+ Net::HTTP.new(WorkOS::API_HOSTNAME, 443).tap do |http_client|
13
+ http_client.use_ssl = true
14
+ end
18
15
  end
19
16
 
20
17
  sig do
@@ -2,5 +2,5 @@
2
2
  # typed: strong
3
3
 
4
4
  module WorkOS
5
- VERSION = '1.5.0'
5
+ VERSION = '1.5.1'
6
6
  end
@@ -2,6 +2,8 @@
2
2
  # typed: false
3
3
 
4
4
  describe WorkOS::AuditTrail do
5
+ it_behaves_like 'client'
6
+
5
7
  describe '.create_event' do
6
8
  context 'with valid event payload' do
7
9
  let(:valid_event) do
@@ -2,6 +2,8 @@
2
2
  # typed: false
3
3
 
4
4
  describe WorkOS::DirectorySync do
5
+ it_behaves_like 'client'
6
+
5
7
  describe '.list_directories' do
6
8
  context 'with no options' do
7
9
  it 'returns directories and metadata' do
@@ -2,6 +2,8 @@
2
2
  # typed: false
3
3
 
4
4
  describe WorkOS::Organizations do
5
+ it_behaves_like 'client'
6
+
5
7
  describe '.create_organization' do
6
8
  context 'with valid payload' do
7
9
  it 'creates an organization' do
@@ -2,6 +2,8 @@
2
2
  # typed: false
3
3
 
4
4
  describe WorkOS::Passwordless do
5
+ it_behaves_like 'client'
6
+
5
7
  describe '.create_session' do
6
8
  context 'with valid options payload' do
7
9
  let(:valid_options) do
@@ -2,6 +2,8 @@
2
2
  # typed: false
3
3
 
4
4
  describe WorkOS::Portal do
5
+ it_behaves_like 'client'
6
+
5
7
  describe '.generate_link' do
6
8
  let(:organization) { 'org_01EHQMYV6MBK39QC5PZXHY59C3' }
7
9
 
@@ -4,6 +4,8 @@
4
4
  require 'securerandom'
5
5
 
6
6
  describe WorkOS::SSO do
7
+ it_behaves_like 'client'
8
+
7
9
  describe '.authorization_url' do
8
10
  context 'with a domain' do
9
11
  let(:args) do
data/spec/spec_helper.rb CHANGED
@@ -18,6 +18,9 @@ require 'webmock/rspec'
18
18
  require 'workos'
19
19
  require 'vcr'
20
20
 
21
+ # Support
22
+ Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
23
+
21
24
  SPEC_ROOT = File.dirname __FILE__
22
25
 
23
26
  VCR.configure do |config|
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ # typed: false
3
+
4
+ RSpec.shared_examples 'client' do
5
+ subject(:client) { described_class.client }
6
+
7
+ it { is_expected.to be_kind_of(Net::HTTP) }
8
+
9
+ it 'assigns use_ssl' do
10
+ expect(client.use_ssl?).to be true
11
+ end
12
+
13
+ it 'returns new instance' do
14
+ expect(described_class.client.object_id).to_not eq described_class.client.object_id
15
+ end
16
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workos
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - WorkOS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-13 00:00:00.000000000 Z
11
+ date: 2021-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -336,6 +336,7 @@ files:
336
336
  - spec/support/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml
337
337
  - spec/support/fixtures/vcr_cassettes/sso/profile.yml
338
338
  - spec/support/profile.txt
339
+ - spec/support/shared_examples/client_spec.rb
339
340
  - workos.gemspec
340
341
  homepage: https://github.com/workos-inc/workos-ruby
341
342
  licenses:
@@ -357,7 +358,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
357
358
  - !ruby/object:Gem::Version
358
359
  version: '0'
359
360
  requirements: []
360
- rubygems_version: 3.2.25
361
+ rubygems_version: 3.2.26
361
362
  signing_key:
362
363
  specification_version: 4
363
364
  summary: API client for WorkOS
@@ -429,3 +430,4 @@ test_files:
429
430
  - spec/support/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml
430
431
  - spec/support/fixtures/vcr_cassettes/sso/profile.yml
431
432
  - spec/support/profile.txt
433
+ - spec/support/shared_examples/client_spec.rb