Class: Mailgun::DomainKeys
- Inherits:
-
Object
- Object
- Mailgun::DomainKeys
- Includes:
- ApiVersionChecker
- Defined in:
- lib/mailgun/domains/domain_keys.rb
Overview
A Mailgun::Domains object is a simple CRUD interface to Mailgun DomainsKeys. Uses Mailgun
Instance Method Summary collapse
-
#activate_domain_key(domain, selector) ⇒ Object
Public: Activate a domain key for a specified authority and selector.
-
#create_domain_key(options = {}) ⇒ Object
Public: Create a domain key.
-
#deactivate_domain_key(domain, selector) ⇒ Object
Public: Deactivate a domain key for a specified authority and selector.
-
#delete_domain_key(options = {}) ⇒ Object
Public: Delete a domain key.
-
#get_domain_keys(domain) ⇒ Object
Public: Lists the domain keys for a specified signing domain / authority.
-
#initialize(client = Mailgun::Client.new) ⇒ DomainKeys
constructor
A new instance of DomainKeys.
-
#list_domain_keys(options = {}) ⇒ Object
Public: List keys for all domains.
-
#update_domain_dkim_authority(domain, options = {}) ⇒ Object
Public: Change the DKIM authority for a domain.
-
#update_domain_dkim_selector(domain, options = {}) ⇒ Object
Public: Update the DKIM selector for a domains.
Methods included from ApiVersionChecker
Constructor Details
#initialize(client = Mailgun::Client.new) ⇒ DomainKeys
Returns a new instance of DomainKeys.
9 10 11 |
# File 'lib/mailgun/domains/domain_keys.rb', line 9 def initialize(client = Mailgun::Client.new) @client = client end |
Instance Method Details
#activate_domain_key(domain, selector) ⇒ Object
Public: Activate a domain key for a specified authority and selector.
domain - [String] Name of the domain (ex. domain.com) selector - [String] The selector you want to activate for the domain key
Returns [Hash] with message key and autority + selector data
56 57 58 |
# File 'lib/mailgun/domains/domain_keys.rb', line 56 def activate_domain_key(domain, selector) @client.put("domains/#{domain}/keys/#{selector}/activate", {}).to_h end |
#create_domain_key(options = {}) ⇒ Object
Public: Create a domain key
options - [Hash] of
signing_domain - [String] Name of the domain (ex. domain.com)
selector - [String] Selector to be used for the new domain key
bits - [Integer] Key size, can be 1024 or 2048
pem - [String] Private key PEM
Returns [Hash] with message key
35 36 37 |
# File 'lib/mailgun/domains/domain_keys.rb', line 35 def create_domain_key( = {}) @client.post('dkim/keys', ).to_h end |
#deactivate_domain_key(domain, selector) ⇒ Object
Public: Deactivate a domain key for a specified authority and selector
domain - [String] Name of the domain (ex. domain.com) selector - [String] The selector you want to activate for the domain key
Returns [Hash] with message key and autority + selector data
75 76 77 |
# File 'lib/mailgun/domains/domain_keys.rb', line 75 def deactivate_domain_key(domain, selector) @client.put("domains/#{domain}/keys/#{selector}/deactivate", {}).to_h end |
#delete_domain_key(options = {}) ⇒ Object
Public: Delete a domain key.
options - [Hash] of
signing_domain - [Integer] Name of the domain (ex. domain.com)
selector - [String] Name of the selector
Returns [Hash] with message key
46 47 48 |
# File 'lib/mailgun/domains/domain_keys.rb', line 46 def delete_domain_key( = {}) @client.delete('dkim/keys', ).to_h end |
#get_domain_keys(domain) ⇒ Object
Public: Lists the domain keys for a specified signing domain / authority
domain - [String] Name of the domain (ex. domain.com)
Returns [Hash] with domain keys data
65 66 67 |
# File 'lib/mailgun/domains/domain_keys.rb', line 65 def get_domain_keys(domain) @client.get("domains/#{domain}/keys").to_h end |
#list_domain_keys(options = {}) ⇒ Object
Public: List keys for all domains
options - [Hash] of
page - [String] Encoded paging information, provided via 'next', 'previous' links
limit - [Integer] Limits the number of items returned in a request
signing_domain - [String] Filter by signing domain
selector - [String] Filter by selector
Returns [Hash] with message key
22 23 24 |
# File 'lib/mailgun/domains/domain_keys.rb', line 22 def list_domain_keys( = {}) @client.get('dkim/keys', ).to_h end |
#update_domain_dkim_authority(domain, options = {}) ⇒ Object
Public: Change the DKIM authority for a domain.
domain - [String] Name of the domain (ex. domain.com) options - [Hash] of
self - [Boolean] true - the domain will be the DKIM authority for itself even
if the root domain is registered on the same mailgun account
Returns [Hash] Information on the DKIM authority
87 88 89 |
# File 'lib/mailgun/domains/domain_keys.rb', line 87 def (domain, = {}) @client.put("domains/#{domain}/dkim_authority", ).to_h end |
#update_domain_dkim_selector(domain, options = {}) ⇒ Object
Public: Update the DKIM selector for a domains
domain - [String] Name of the domain (ex. domain.com) options - [Hash] of
dkim_selector - [String] change the DKIM selector for a domain.
Returns [Hash] with message key
98 99 100 |
# File 'lib/mailgun/domains/domain_keys.rb', line 98 def update_domain_dkim_selector(domain, = {}) @client.put("domains/#{domain}/dkim_selector", ).to_h end |