Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
* [#550](https://github.com/workos/workos-ruby/pull/550) fix(generated): regenerate from spec

**Features**
* **[pipes](https://workos.com/docs/reference/pipes)**:
* Added `connected_account_id` to `DataIntegrationsVendCredentialsRequest`
* Added `connected_account_id` to `DataIntegrationsGetUserTokenRequest`
* Added parameter `UserManagementDataProviders.getUserDataInstallation.connected_account_id`
* Changed errors for endpoint `GET /user_management/users/{user_id}/connected_accounts/{slug}`
* Added parameter `UserManagementDataProviders.updateUserDataInstallation.connected_account_id`
* Changed errors for endpoint `PUT /user_management/users/{user_id}/connected_accounts/{slug}`
* Added parameter `UserManagementDataProviders.deleteUserDataInstallation.connected_account_id`
* Changed errors for endpoint `DELETE /user_management/users/{user_id}/connected_accounts/{slug}`
* Added `connected_accounts` to `DataIntegrationsListResponseData`
* Changed errors for endpoint `PUT /data-integrations/{slug}`
* Changed errors for endpoint `PUT /data-integrations/{slug}/api-key`
* Changed errors for endpoint `PUT /data-integrations/{slug}/client-credentials`
* Changed errors for endpoint `POST /data-integrations/{slug}/credentials`
* Changed errors for endpoint `POST /data-integrations/{provider}/token`
2 changes: 1 addition & 1 deletion .last-synced-sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
edb560e2be3f54b668ea8d11fa5a060c87ab5087
6fba233c50a5b651b2df7b859b75bfe715bc825a
27 changes: 21 additions & 6 deletions lib/workos/pipes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,20 @@ def update_data_integration_client_credentials(
# @param slug [String] The identifier of the integration.
# @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
# @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
# @param connected_account_id [String, nil] A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the user has several for this provider.
# @param request_options [Hash] (see WorkOS::Types::RequestOptions)
# @return [WorkOS::DataIntegrationCredentialsResponse]
def create_data_integration_credential(
slug:,
user_id:,
organization_id: nil,
connected_account_id: nil,
request_options: {}
)
body = {
"user_id" => user_id,
"organization_id" => organization_id
"organization_id" => organization_id,
"connected_account_id" => connected_account_id

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Account selector serialization untested

None of the five updated operations has a request test that supplies connected_account_id and checks where it is serialized. Add coverage for both the POST-body and query-parameter forms so a future generator regression cannot silently place the account selector in the wrong part of the request.

Knowledge Base Used: Connect, Pipes, and Admin Portal

Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/workos/pipes.rb
Line: 299

Comment:
**Account selector serialization untested**

None of the five updated operations has a request test that supplies `connected_account_id` and checks where it is serialized. Add coverage for both the POST-body and query-parameter forms so a future generator regression cannot silently place the account selector in the wrong part of the request.

**Knowledge Base Used:** [Connect, Pipes, and Admin Portal](https://app.greptile.com/workos/-/custom-context/knowledge-base/workos/workos-ruby/-/docs/connect-pipes-and-admin-portal.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

}.compact
response = @client.request(
method: :post,
Expand All @@ -311,17 +314,20 @@ def create_data_integration_credential(
# @param provider [String] The identifier of the integration.
# @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
# @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization.
# @param connected_account_id [String, nil] A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the user has several for this provider.
# @param request_options [Hash] (see WorkOS::Types::RequestOptions)
# @return [WorkOS::DataIntegrationAccessTokenResponse]
def get_access_token(
provider:,
user_id:,
organization_id: WorkOS::OMIT,
connected_account_id: nil,
request_options: {}
)
body = {
"user_id" => user_id
}
"user_id" => user_id,
"connected_account_id" => connected_account_id
}.compact
body["organization_id"] = organization_id unless organization_id.equal?(WorkOS::OMIT)
response = @client.request(
method: :post,
Expand All @@ -339,16 +345,19 @@ def get_access_token(
# @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
# @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
# @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
# @param connected_account_id [String, nil] A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select a specific connection when the user has several for this provider.
# @param request_options [Hash] (see WorkOS::Types::RequestOptions)
# @return [WorkOS::ConnectedAccount]
def get_user_connected_account(
user_id:,
slug:,
organization_id: nil,
connected_account_id: nil,
request_options: {}
)
params = {
"organization_id" => organization_id
"organization_id" => organization_id,
"connected_account_id" => connected_account_id
}.compact
response = @client.request(
method: :get,
Expand Down Expand Up @@ -416,6 +425,7 @@ def create_user_connected_account(
# @param scopes [Array<String>, nil] The OAuth scopes granted for this connection.
# @param state [WorkOS::Types::ConnectedAccountInputState, nil] Explicitly set the state of the connected account. When omitted, the state is derived from the token combination provided.
# @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
# @param connected_account_id [String, nil] A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to update.
# @param request_options [Hash] (see WorkOS::Types::RequestOptions)
# @return [WorkOS::ConnectedAccount]
def update_user_connected_account(
Expand All @@ -427,10 +437,12 @@ def update_user_connected_account(
scopes: nil,
state: nil,
organization_id: nil,
connected_account_id: nil,
request_options: {}
)
params = {
"organization_id" => organization_id
"organization_id" => organization_id,
"connected_account_id" => connected_account_id
}.compact
body = {
"access_token" => access_token,
Expand All @@ -456,16 +468,19 @@ def update_user_connected_account(
# @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier.
# @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`).
# @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization.
# @param connected_account_id [String, nil] A [connected account](https://workos.com/docs/reference/pipes/connected-account) identifier. Use this to select the connection to delete.
# @param request_options [Hash] (see WorkOS::Types::RequestOptions)
# @return [void]
def delete_user_connected_account(
user_id:,
slug:,
organization_id: nil,
connected_account_id: nil,
request_options: {}
)
params = {
"organization_id" => organization_id
"organization_id" => organization_id,
"connected_account_id" => connected_account_id
}.compact
@client.request(
method: :delete,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ module WorkOS
class DataIntegrationsGetUserTokenRequest < WorkOS::Types::BaseModel
HASH_ATTRS = {
user_id: :user_id,
organization_id: :organization_id
organization_id: :organization_id,
connected_account_id: :connected_account_id
}.freeze

attr_accessor \
:user_id,
:organization_id
:organization_id,
:connected_account_id

def initialize(json)
hash = self.class.normalize(json)
@user_id = hash[:user_id]
@organization_id = hash[:organization_id]
@connected_account_id = hash[:connected_account_id]
end
end
end
7 changes: 5 additions & 2 deletions lib/workos/pipes/data_integrations_list_response_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class DataIntegrationsListResponseData < WorkOS::Types::BaseModel
ownership: :ownership,
created_at: :created_at,
updated_at: :updated_at,
connected_account: :connected_account
connected_account: :connected_account,
connected_accounts: :connected_accounts
}.freeze

attr_accessor \
Expand All @@ -33,7 +34,8 @@ class DataIntegrationsListResponseData < WorkOS::Types::BaseModel
:ownership,
:created_at,
:updated_at,
:connected_account
:connected_account,
:connected_accounts

def initialize(json)
hash = self.class.normalize(json)
Expand All @@ -50,6 +52,7 @@ def initialize(json)
@created_at = hash[:created_at]
@updated_at = hash[:updated_at]
@connected_account = hash[:connected_account] ? WorkOS::DataIntegrationsListResponseDataConnectedAccount.new(hash[:connected_account]) : nil
@connected_accounts = (hash[:connected_accounts] || []).map { |item| item ? WorkOS::DataIntegrationsListResponseDataConnectedAccount.new(item) : nil }
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ module WorkOS
class DataIntegrationsVendCredentialsRequest < WorkOS::Types::BaseModel
HASH_ATTRS = {
user_id: :user_id,
organization_id: :organization_id
organization_id: :organization_id,
connected_account_id: :connected_account_id
}.freeze

attr_accessor \
:user_id,
:organization_id
:organization_id,
:connected_account_id

def initialize(json)
hash = self.class.normalize(json)
@user_id = hash[:user_id]
@organization_id = hash[:organization_id]
@connected_account_id = hash[:connected_account_id]
end
end
end
6 changes: 6 additions & 0 deletions rbi/workos/data_integrations_get_user_token_request.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ module WorkOS
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
def organization_id=(value); end

sig { returns(T.nilable(String)) }
def connected_account_id; end

sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
def connected_account_id=(value); end

sig { returns(T::Hash[Symbol, T.untyped]) }
def to_h; end

Expand Down
6 changes: 6 additions & 0 deletions rbi/workos/data_integrations_list_response_data.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ module WorkOS
sig { params(value: T.nilable(WorkOS::DataIntegrationsListResponseDataConnectedAccount)).returns(T.nilable(WorkOS::DataIntegrationsListResponseDataConnectedAccount)) }
def connected_account=(value); end

sig { returns(T::Array[WorkOS::DataIntegrationsListResponseDataConnectedAccount]) }
def connected_accounts; end

sig { params(value: T::Array[WorkOS::DataIntegrationsListResponseDataConnectedAccount]).returns(T::Array[WorkOS::DataIntegrationsListResponseDataConnectedAccount]) }
def connected_accounts=(value); end

sig { returns(T::Hash[Symbol, T.untyped]) }
def to_h; end

Expand Down
6 changes: 6 additions & 0 deletions rbi/workos/data_integrations_vend_credentials_request.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ module WorkOS
sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
def organization_id=(value); end

sig { returns(T.nilable(String)) }
def connected_account_id; end

sig { params(value: T.nilable(String)).returns(T.nilable(String)) }
def connected_account_id=(value); end

sig { returns(T::Hash[Symbol, T.untyped]) }
def to_h; end

Expand Down
15 changes: 10 additions & 5 deletions rbi/workos/pipes.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -107,30 +107,33 @@ module WorkOS
slug: String,
user_id: String,
organization_id: T.nilable(String),
connected_account_id: T.nilable(String),
request_options: T::Hash[Symbol, T.untyped]
).returns(WorkOS::DataIntegrationCredentialsResponse)
end
def create_data_integration_credential(slug:, user_id:, organization_id:, request_options:); end
def create_data_integration_credential(slug:, user_id:, organization_id:, connected_account_id:, request_options:); end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Optional keyword declared required

The Ruby methods allow callers to omit connected_account_id by defaulting it to nil, but these RBI declarations make the keyword required. Existing Sorbet callers that omit it will therefore get a missing-keyword error even though the call is valid at runtime. Preserve the runtime default in all five updated Pipes declarations.

Prompt To Fix With AI
This is a comment left during a code review.
Path: rbi/workos/pipes.rbi
Line: 114

Comment:
**Optional keyword declared required**

The Ruby methods allow callers to omit `connected_account_id` by defaulting it to `nil`, but these RBI declarations make the keyword required. Existing Sorbet callers that omit it will therefore get a missing-keyword error even though the call is valid at runtime. Preserve the runtime default in all five updated Pipes declarations.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.


sig do
params(
provider: String,
user_id: String,
organization_id: T.nilable(String),
connected_account_id: T.nilable(String),
request_options: T::Hash[Symbol, T.untyped]
).returns(WorkOS::DataIntegrationAccessTokenResponse)
end
def get_access_token(provider:, user_id:, organization_id:, request_options:); end
def get_access_token(provider:, user_id:, organization_id:, connected_account_id:, request_options:); end

sig do
params(
user_id: String,
slug: String,
organization_id: T.nilable(String),
connected_account_id: T.nilable(String),
request_options: T::Hash[Symbol, T.untyped]
).returns(WorkOS::ConnectedAccount)
end
def get_user_connected_account(user_id:, slug:, organization_id:, request_options:); end
def get_user_connected_account(user_id:, slug:, organization_id:, connected_account_id:, request_options:); end

sig do
params(
Expand All @@ -157,20 +160,22 @@ module WorkOS
scopes: T.nilable(T::Array[String]),
state: T.nilable(String),
organization_id: T.nilable(String),
connected_account_id: T.nilable(String),
request_options: T::Hash[Symbol, T.untyped]
).returns(WorkOS::ConnectedAccount)
end
def update_user_connected_account(user_id:, slug:, access_token:, refresh_token:, expires_at:, scopes:, state:, organization_id:, request_options:); end
def update_user_connected_account(user_id:, slug:, access_token:, refresh_token:, expires_at:, scopes:, state:, organization_id:, connected_account_id:, request_options:); end

sig do
params(
user_id: String,
slug: String,
organization_id: T.nilable(String),
connected_account_id: T.nilable(String),
request_options: T::Hash[Symbol, T.untyped]
).returns(NilClass)
end
def delete_user_connected_account(user_id:, slug:, organization_id:, request_options:); end
def delete_user_connected_account(user_id:, slug:, organization_id:, connected_account_id:, request_options:); end

sig do
params(
Expand Down
9 changes: 6 additions & 3 deletions test/workos/test_pipes_model_round_trip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ def test_data_integrations_list_response_data_round_trip
"ownership" => "stub",
"created_at" => "stub",
"updated_at" => "stub",
"connected_account" => nil
"connected_account" => nil,
"connected_accounts" => []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Nested accounts remain untested

The new fixture uses an empty connected_accounts array, so it never exercises construction or serialization of a nested connected-account model. Use at least one representative account and assert its nested values; otherwise an incorrect element class or serialization mapping could pass this test.

Knowledge Base Used: Connect, Pipes, and Admin Portal

Prompt To Fix With AI
This is a comment left during a code review.
Path: test/workos/test_pipes_model_round_trip.rb
Line: 244

Comment:
**Nested accounts remain untested**

The new fixture uses an empty `connected_accounts` array, so it never exercises construction or serialization of a nested connected-account model. Use at least one representative account and assert its nested values; otherwise an incorrect element class or serialization mapping could pass this test.

**Knowledge Base Used:** [Connect, Pipes, and Admin Portal](https://app.greptile.com/workos/-/custom-context/knowledge-base/workos/workos-ruby/-/docs/connect-pipes-and-admin-portal.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

}
model = WorkOS::DataIntegrationsListResponseData.new(fixture.to_json)
json = model.to_h
Expand Down Expand Up @@ -397,7 +398,8 @@ def test_data_integrations_upsert_client_credentials_request_round_trip
def test_data_integrations_vend_credentials_request_round_trip
fixture = {
"user_id" => "stub",
"organization_id" => "stub"
"organization_id" => "stub",
"connected_account_id" => "stub"
}
model = WorkOS::DataIntegrationsVendCredentialsRequest.new(fixture.to_json)
json = model.to_h
Expand All @@ -409,7 +411,8 @@ def test_data_integrations_vend_credentials_request_round_trip
def test_data_integrations_get_user_token_request_round_trip
fixture = {
"user_id" => "stub",
"organization_id" => nil
"organization_id" => nil,
"connected_account_id" => "stub"
}
model = WorkOS::DataIntegrationsGetUserTokenRequest.new(fixture.to_json)
json = model.to_h
Expand Down
Loading