Skip to content

Commit

Permalink
Make directory domain nullable (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
blairlunceford authored Nov 3, 2021
1 parent 01738a7 commit 18c53ec
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 136 deletions.
2 changes: 1 addition & 1 deletion lib/workos/directory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def initialize(json)

@id = T.let(raw.id, String)
@name = T.let(raw.name, String)
@domain = T.let(raw.domain, String)
@domain = raw.domain
@type = T.let(raw.type, String)
@state = T.let(raw.state, String)
@organization_id = T.let(raw.organization_id, String)
Expand Down
2 changes: 1 addition & 1 deletion lib/workos/types/directory_struct.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Types
class DirectoryStruct < T::Struct
const :id, String
const :name, String
const :domain, String
const :domain, T.nilable(String)
const :type, String
const :state, String
const :organization_id, String
Expand Down
21 changes: 11 additions & 10 deletions spec/lib/workos/directory_sync_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
VCR.use_cassette 'directory_sync/list_directories/with_no_options' do
directories = described_class.list_directories

expect(directories.data.size).to eq(3)
expect(directories.data.size).to eq(10)
expect(directories.list_metadata).to eq(expected_metadata)
end
end
Expand Down Expand Up @@ -46,7 +46,7 @@
context 'with search option' do
it 'forms the proper request to the API' do
request_args = [
'/directories?search=Foo',
'/directories?search=Testing',
'Content-Type' => 'application/json'
]

Expand All @@ -57,18 +57,19 @@

VCR.use_cassette 'directory_sync/list_directories/with_search' do
directories = described_class.list_directories(
search: 'Foo',
search: 'Testing',
)

expect(directories.data.size).to eq(1)
expect(directories.data.size).to eq(2)
expect(directories.data[0].name).to include('Testing')
end
end
end

context 'with the before option' do
it 'forms the proper request to the API' do
request_args = [
'/directories?before=before-id',
'/directories?before=directory_01FGCPNV312FHFRCX0BYWHVSE1',
'Content-Type' => 'application/json'
]

Expand All @@ -79,18 +80,18 @@

VCR.use_cassette 'directory_sync/list_directories/with_before' do
directories = described_class.list_directories(
before: 'before-id',
before: 'directory_01FGCPNV312FHFRCX0BYWHVSE1',
)

expect(directories.data.size).to eq(3)
expect(directories.data.size).to eq(6)
end
end
end

context 'with the after option' do
it 'forms the proper request to the API' do
request_args = [
'/directories?after=after-id',
'/directories?after=directory_01FGCPNV312FHFRCX0BYWHVSE1',
'Content-Type' => 'application/json'
]

Expand All @@ -100,9 +101,9 @@
and_return(expected_request)

VCR.use_cassette 'directory_sync/list_directories/with_after' do
directories = described_class.list_directories(after: 'after-id')
directories = described_class.list_directories(after: 'directory_01FGCPNV312FHFRCX0BYWHVSE1')

expect(directories.data.size).to eq(3)
expect(directories.data.size).to eq(4)
end
end
end
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 18c53ec

Please sign in to comment.