Class: Nylas::Credentials

Inherits:
Resource show all
Includes:
ApiOperations::Delete, ApiOperations::Get, ApiOperations::Patch, ApiOperations::Post
Defined in:
lib/nylas/resources/credentials.rb

Overview

Nylas Connectors API

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Nylas::Resource

Instance Method Details

#create(provider:, request_body:) ⇒ Array(Hash, String)

Create a connector.

Parameters:

  • provider (String)

    The provider associated to the credential being created

  • request_body (Hash)

    The values to create the connector with.

Returns:

  • (Array(Hash, String))

    The created connector and API Request ID.



42
43
44
45
46
47
# 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:) ⇒ Array(TrueClass, String)

Delete a connector.

Parameters:

  • provider (String)

    The provider associated to the connector to delete.

  • credential_id (String)

    The id of the credentials to delete.

Returns:

  • (Array(TrueClass, String))

    True and the API Request ID for the delete operation.



67
68
69
70
71
72
73
# 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:) ⇒ Array(Hash, String)

Return a connector.

Parameters:

  • provider (String)

    The provider associated to the connector to retrieve.

  • credential_id (String)

    The id of the credentials to retrieve.

Returns:

  • (Array(Hash, String))

    The connector and API request ID.



31
32
33
34
35
# 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) ⇒ Array(Array(Hash), String)

Return all credentials.

Parameters:

  • provider (String)

    The provider associated to the credential to list from

  • query_params (Hash, nil) (defaults to: nil)

    Query params to pass to the request.

Returns:

  • (Array(Array(Hash), String))

    The list of credentials and API Request ID.



19
20
21
22
23
24
# 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:) ⇒ Array(Hash, String)

Update a connector.

Parameters:

  • provider (String)

    The provider associated to the connector to update from.

  • credential_id (String)

    The id of the credentials to update.

  • request_body (Hash)

    The values to update the connector with

Returns:

  • (Array(Hash, String))

    The updated connector and API Request ID.



55
56
57
58
59
60
# 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