Class: Nylas::Connectors

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

Overview

Nylas Connectors API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sdk_instance) ⇒ Connectors

Initializes Connectors.



18
19
20
21
22
# File 'lib/nylas/resources/connectors.rb', line 18

def initialize(sdk_instance)
  super(sdk_instance)

  @credentials = Credentials.new(sdk_instance)
end

Instance Attribute Details

#credentialsObject (readonly)

Access the Credentials API



15
16
17
# File 'lib/nylas/resources/connectors.rb', line 15

def credentials
  @credentials
end

Instance Method Details

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

Create a connector.

Parameters:

  • request_body (Hash)

    The values to create the connector with.

Returns:

  • (Array(Hash, String))

    The created connector and API Request ID.



49
50
51
52
53
54
# File 'lib/nylas/resources/connectors.rb', line 49

def create(request_body:)
  post(
    path: "#{api_uri}/v3/connectors",
    request_body: request_body
  )
end

#destroy(provider:) ⇒ Array(TrueClass, String)

Delete a connector.

Parameters:

  • provider (String)

    The provider associated to the connector to delete.

Returns:

  • (Array(TrueClass, String))

    True and the API Request ID for the delete operation.



72
73
74
75
76
77
78
# File 'lib/nylas/resources/connectors.rb', line 72

def destroy(provider:)
  _, request_id = delete(
    path: "#{api_uri}/v3/connectors/#{provider}"
  )

  [true, request_id]
end

#find(provider:) ⇒ Array(Hash, String)

Return a connector.

Parameters:

  • provider (String)

    The provider associated to the connector to retrieve.

Returns:

  • (Array(Hash, String))

    The connector and API request ID.



39
40
41
42
43
# File 'lib/nylas/resources/connectors.rb', line 39

def find(provider:)
  get(
    path: "#{api_uri}/v3/connectors/#{provider}"
  )
end

#list(query_params: nil) ⇒ Array(Array(Hash), String)

Return all connectors.

Parameters:

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

    Query params to pass to the request.

Returns:

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

    The list of connectors and API Request ID.



28
29
30
31
32
33
# File 'lib/nylas/resources/connectors.rb', line 28

def list(query_params: nil)
  get(
    path: "#{api_uri}/v3/connectors",
    query_params: query_params
  )
end

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

Update a connector.

Parameters:

  • provider (String)

    The provider associated to the connector to update.

  • request_body (Hash)

    The values to update the connector with

Returns:

  • (Array(Hash, String))

    The updated connector and API Request ID.



61
62
63
64
65
66
# File 'lib/nylas/resources/connectors.rb', line 61

def update(provider:, request_body:)
  patch(
    path: "#{api_uri}/v3/connectors/#{provider}",
    request_body: request_body
  )
end