Class: Nylas::Connectors

Inherits:
Resource show all
Includes:
ApiOperations::Delete, ApiOperations::Get, ApiOperations::Patch, ApiOperations::Post, ApiOperations::Put
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.



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

def initialize(sdk_instance)
  super(sdk_instance)

  @credentials = Credentials.new(sdk_instance)
end

Instance Attribute Details

#credentialsObject (readonly)

Access the Credentials API



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

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.



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

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.



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

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.



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

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.



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

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.



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

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