Class: Nylas::Domains

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

Overview

Nylas Manage Domains API

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Nylas::Resource

Instance Method Details

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

Create a domain.

Parameters:

  • request_body (Hash)

    The values to create the domain with. Requires name and domain_address.

Returns:

  • (Array(Hash, String, Hash))

    The created domain, API Request ID, and response headers.



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

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

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

Delete a domain.

Parameters:

  • domain_id (String)

    The identifier of the domain to delete. Accepts either a UUID or a domain address (FQDN/email format).

Returns:

  • (Array(TrueClass, String))

    True and the API Request ID for the delete operation.



88
89
90
91
92
93
94
# File 'lib/nylas/resources/domains.rb', line 88

def destroy(domain_id:)
  _, request_id = delete(
    path: "#{api_uri}/v3/admin/domains/#{domain_id}"
  )

  [true, request_id]
end

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

Return a domain.

Parameters:

  • domain_id (String)

    The identifier of the domain to return. Accepts either a UUID or a domain address (FQDN/email format).

Returns:

  • (Array(Hash, String, Hash))

    The domain, API request ID, and response headers.



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

def find(domain_id:)
  get(
    path: "#{api_uri}/v3/admin/domains/#{domain_id}"
  )
end

#info(domain_id:, request_body:) ⇒ Array(Hash, String, Hash)

Get the DNS record info for a domain verification type.

Parameters:

  • domain_id (String)

    The identifier of the domain. Accepts either a UUID or a domain address (FQDN/email format).

  • request_body (Hash)

    The verification attempt values. Requires type.

Returns:

  • (Array(Hash, String, Hash))

    The domain verification result, API Request ID, and response headers.



103
104
105
106
107
108
# File 'lib/nylas/resources/domains.rb', line 103

def info(domain_id:, request_body:)
  post(
    path: "#{api_uri}/v3/admin/domains/#{domain_id}/info",
    request_body: request_body
  )
end

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

Return all domains for the caller's organization.

Parameters:

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

    Query params to pass to the request. Supported keys: domain (filter by exact domain address), region, limit, page_token.

Returns:

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

    The list of domains, API Request ID, next cursor, and response headers.



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

def list(query_params: nil)
  get_list(
    path: "#{api_uri}/v3/admin/domains",
    query_params: query_params
  )
end

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

Update a domain.

Parameters:

  • domain_id (String)

    The identifier of the domain to update. Accepts either a UUID or a domain address (FQDN/email format).

  • request_body (Hash)

    The values to update the domain with. The response echoes only the updated fields, not a full domain object.

Returns:

  • (Array(Hash, String))

    The updated domain fields and API Request ID.



76
77
78
79
80
81
# File 'lib/nylas/resources/domains.rb', line 76

def update(domain_id:, request_body:)
  put(
    path: "#{api_uri}/v3/admin/domains/#{domain_id}",
    request_body: request_body
  )
end

#verify(domain_id:, request_body:) ⇒ Array(Hash, String, Hash)

Trigger a DNS verification check for a domain verification type.

Parameters:

  • domain_id (String)

    The identifier of the domain. Accepts either a UUID or a domain address (FQDN/email format).

  • request_body (Hash)

    The verification attempt values. Requires type.

Returns:

  • (Array(Hash, String, Hash))

    The domain verification result, API Request ID, and response headers.



117
118
119
120
121
122
# File 'lib/nylas/resources/domains.rb', line 117

def verify(domain_id:, request_body:)
  post(
    path: "#{api_uri}/v3/admin/domains/#{domain_id}/verify",
    request_body: request_body
  )
end