This is the Mailgun Ruby Domain utilities.
The below assumes you've already installed the Mailgun Ruby SDK in to your project. If not, go back to the master README for instructions. It currently supports all calls except credentials.
First, instantiate the Mailgun Client with your API key
mg_client = Mailgun::Client.new('your-api-key')
domainer = Mailgun::Domains.new(mg_client)Core Domain methods:
# Get a list of current domains.
domainer.list
# Add a new domain
domainer.create 'my.new.moreness'
# or with options
domainer.create 'my.new.moreness', { some: 'options' }
# View details of a domain
domainer.get 'my.perfect.domain'
# Update a domain
domainer.update 'my.new.moreness', { some: 'options' }
# Verify a domain
domainer.verify 'my.perfect.domain'
# Remove a domain
domainer.remove 'this.one.is.not.needed.'
Domain Tracking methods:
# Get tracking settings
domainer.get_domain_tracking_settings 'my.perfect.domain'
# Update click tracking settings
domainer.update_domain_tracking_click_settings 'my.perfect.domain', { some: 'options' }
# Update open tracking settings
domainer.update_domain_tracking_open_settings 'my.perfect.domain', { some: 'options' }
# Update unsubscribe tracking settings
domainer.update_domain_tracking_unsubscribe_settings 'my.perfect.domain', { some: 'options' }
# Tracking Certificate: Get certificate and status
domainer.get_domain_tracking_certificate 'my.perfect.domain'
# Tracking Certificate: Regenerate expired certificate
domainer.regenerate_domain_tracking_certificate 'my.perfect.domain', { some: 'options' }
# Tracking Certificate: Generate
domainer.generate_domain_tracking_certificate 'my.perfect.domain', { some: 'options' }DKIM Security methods:
# Update Automatic Sender Security DKIM key rotation for a domain
domainer.dkim_rotation 'my.perfect.domain', true, { some: 'options' }
# Rotate Automatic Sender Security DKIM key for a domain
domainer.dkim_rotate 'my.perfect.domain'See the official Mailgun Domain Docs for more information