class Nylas::Credentials

Nylas Connectors API

Public Instance Methods

create(provider:, request_body:) click to toggle source

Create a connector.

@param provider [String] The provider associated to the credential being created @param request_body [Hash] The values to create the connector with. @return [Array(Hash, String)] The created connector and API Request ID.

# File lib/nylas/resources/credentials.rb, line 42
def create(provider:, request_body:)
  post(
    path: "#{api_uri}/v3/connectors/#{provider}/creds",
    request_body: request_body
  )
end
destroy(provider:, credential_id:) click to toggle source

Delete a connector.

@param provider [String] The provider associated to the connector to delete. @param credential_id [String] The id of the credentials to delete. @return [Array(TrueClass, String)] True and the API Request ID for the delete operation.

# File lib/nylas/resources/credentials.rb, line 67
def destroy(provider:, credential_id:)
  _, request_id = delete(
    path: "#{api_uri}/v3/connectors/#{provider}/creds/#{credential_id}"
  )

  [true, request_id]
end
find(provider:, credential_id:) click to toggle source

Return a connector.

@param provider [String] The provider associated to the connector to retrieve. @param credential_id [String] The id of the credentials to retrieve. @return [Array(Hash, String)] The connector and API request ID.

# File lib/nylas/resources/credentials.rb, line 31
def find(provider:, credential_id:)
  get(
    path: "#{api_uri}/v3/connectors/#{provider}/creds/#{credential_id}"
  )
end
list(provider:, query_params: nil) click to toggle source

Return all credentials.

@param provider [String] The provider associated to the credential to list from @param query_params [Hash, nil] Query params to pass to the request. @return [Array(Array(Hash), String)] The list of credentials and API Request ID.

# File lib/nylas/resources/credentials.rb, line 19
def list(provider:, query_params: nil)
  get(
    path: "#{api_uri}/v3/connectors/#{provider}/creds",
    query_params: query_params
  )
end
update(provider:, credential_id:, request_body:) click to toggle source

Update a connector.

@param provider [String] The provider associated to the connector to update from. @param credential_id [String] The id of the credentials to update. @param request_body [Hash] The values to update the connector with @return [Array(Hash, String)] The updated connector and API Request ID.

# File lib/nylas/resources/credentials.rb, line 55
def update(provider:, credential_id:, request_body:)
  patch(
    path: "#{api_uri}/v3/connectors/#{provider}/creds/#{credential_id}",
    request_body: request_body
  )
end