Class: Nylas::Domains
- Includes:
- ApiOperations::Delete, ApiOperations::Get, ApiOperations::Post, ApiOperations::Put
- Defined in:
- lib/nylas/resources/domains.rb
Overview
Nylas Manage Domains API
These endpoints require Nylas Service Account request signing. Pass headers
containing X-Nylas-Kid, X-Nylas-Timestamp, X-Nylas-Nonce, and
X-Nylas-Signature generated for the exact request being sent.
Constant Summary collapse
- REQUIRED_SERVICE_ACCOUNT_HEADERS =
%w[ X-Nylas-Kid X-Nylas-Timestamp X-Nylas-Nonce X-Nylas-Signature ].freeze
- DOMAINS_PATH =
"/v3/admin/domains"
Instance Method Summary collapse
-
#create(request_body:, headers: nil, signer: nil) ⇒ Array(Hash, String, Hash)
Create a domain.
-
#destroy(domain_id:, headers: nil, signer: nil) ⇒ Array(TrueClass, String)
Delete a domain.
-
#find(domain_id:, headers: nil, signer: nil) ⇒ Array(Hash, String, Hash)
Return a domain.
-
#info(domain_id:, request_body:, headers: nil, signer: nil) ⇒ Array(Hash, String, Hash)
Get the DNS record info for a domain verification type.
-
#list(headers: nil, query_params: nil, signer: nil) ⇒ Array(Array(Hash), String, String, Hash)
Return all domains for the caller's organization.
-
#update(domain_id:, request_body:, headers: nil, signer: nil) ⇒ Array(Hash, String)
Update a domain.
-
#verify(domain_id:, request_body:, headers: nil, signer: nil) ⇒ Array(Hash, String, Hash)
Trigger a DNS verification check for a domain verification type.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Nylas::Resource
Instance Method Details
#create(request_body:, headers: nil, signer: nil) ⇒ Array(Hash, String, Hash)
Create a domain.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/nylas/resources/domains.rb', line 90 def create(request_body:, headers: nil, signer: nil) request_headers, serialized_body = signed_request_headers( method: :post, relative_path: DOMAINS_PATH, body: request_body, headers: headers, signer: signer ) request = { path: full_path(DOMAINS_PATH), request_body: serialized_body.nil? ? request_body : nil, headers: request_headers } request[:serialized_json_body] = serialized_body unless serialized_body.nil? post(**request) end |
#destroy(domain_id:, headers: nil, signer: nil) ⇒ Array(TrueClass, String)
Delete a domain.
143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/nylas/resources/domains.rb', line 143 def destroy(domain_id:, headers: nil, signer: nil) relative_path = "#{DOMAINS_PATH}/#{domain_id}" request_headers, = signed_request_headers(method: :delete, relative_path: relative_path, headers: headers, signer: signer) _, request_id = delete( path: full_path(relative_path), headers: request_headers ) [true, request_id] end |
#find(domain_id:, headers: nil, signer: nil) ⇒ Array(Hash, String, Hash)
Return a domain.
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/nylas/resources/domains.rb', line 72 def find(domain_id:, headers: nil, signer: nil) relative_path = "#{DOMAINS_PATH}/#{domain_id}" request_headers, = signed_request_headers(method: :get, relative_path: relative_path, headers: headers, signer: signer) get( path: full_path(relative_path), headers: request_headers ) end |
#info(domain_id:, request_body:, headers: nil, signer: nil) ⇒ Array(Hash, String, Hash)
Get the DNS record info for a domain verification type.
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/nylas/resources/domains.rb', line 165 def info(domain_id:, request_body:, headers: nil, signer: nil) relative_path = "#{DOMAINS_PATH}/#{domain_id}/info" request_headers, serialized_body = signed_request_headers( method: :post, relative_path: relative_path, body: request_body, headers: headers, signer: signer ) request = { path: full_path(relative_path), request_body: serialized_body.nil? ? request_body : nil, headers: request_headers } request[:serialized_json_body] = serialized_body unless serialized_body.nil? post(**request) end |
#list(headers: nil, query_params: nil, signer: nil) ⇒ Array(Array(Hash), String, String, Hash)
Return all domains for the caller's organization.
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/nylas/resources/domains.rb', line 54 def list(headers: nil, query_params: nil, signer: nil) request_headers, = signed_request_headers(method: :get, relative_path: DOMAINS_PATH, headers: headers, signer: signer) get_list( path: full_path(DOMAINS_PATH), query_params: query_params, headers: request_headers ) end |
#update(domain_id:, request_body:, headers: nil, signer: nil) ⇒ Array(Hash, String)
Update a domain.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/nylas/resources/domains.rb', line 117 def update(domain_id:, request_body:, headers: nil, signer: nil) relative_path = "#{DOMAINS_PATH}/#{domain_id}" request_headers, serialized_body = signed_request_headers( method: :put, relative_path: relative_path, body: request_body, headers: headers, signer: signer ) request = { path: full_path(relative_path), request_body: serialized_body.nil? ? request_body : nil, headers: request_headers } request[:serialized_json_body] = serialized_body unless serialized_body.nil? put(**request) end |
#verify(domain_id:, request_body:, headers: nil, signer: nil) ⇒ Array(Hash, String, Hash)
Trigger a DNS verification check for a domain verification type.
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/nylas/resources/domains.rb', line 193 def verify(domain_id:, request_body:, headers: nil, signer: nil) relative_path = "#{DOMAINS_PATH}/#{domain_id}/verify" request_headers, serialized_body = signed_request_headers( method: :post, relative_path: relative_path, body: request_body, headers: headers, signer: signer ) request = { path: full_path(relative_path), request_body: serialized_body.nil? ? request_body : nil, headers: request_headers } request[:serialized_json_body] = serialized_body unless serialized_body.nil? post(**request) end |