Module: Mailblastr::Domains
- Defined in:
- lib/mailblastr/domains.rb
Class Method Summary collapse
-
.apply_cloudflare_dns(domain_id, params) ⇒ Object
Apply DNS records via the Cloudflare API, then auto-verify.
-
.apply_godaddy_dns(domain_id, params) ⇒ Object
Apply DNS records via the GoDaddy API, then auto-verify.
-
.apply_namecheap_dns(domain_id, params) ⇒ Object
Apply DNS records via the Namecheap API (existing records preserved), then auto-verify.
-
.claim(params) ⇒ Object
Claim a domain already verified in another account.
-
.create(params) ⇒ Object
Register a sending domain.
-
.delete(domain_id) ⇒ Object
DELETE /domains/:id.
-
.detect_dns(domain_id) ⇒ Object
Detect the DNS provider and available one-click apply methods.
-
.get(domain_id) ⇒ Object
GET /domains/:id.
-
.get_claim(domain_id) ⇒ Object
Retrieve a domain's claim record.
-
.list(params = {}) ⇒ Object
GET /domains — with no pagination params one page carries up to 1,000 domains and
has_morereports any truncation; passlimitand walkafterto read past that. -
.mx_check(name) ⇒ Object
Check a domain's live MX records before adding receiving.
-
.records_csv(domain_id) ⇒ Object
Download the domain's DNS records as CSV text (a String, not JSON).
-
.update(domain_id, params) ⇒ Object
PATCH /domains/:id (returns the slim ack { object: "domain", id }).
-
.verify(domain_id) ⇒ Object
Trigger DNS verification.
-
.verify_claim(domain_id) ⇒ Object
Verify a domain claim's TXT record.
Class Method Details
.apply_cloudflare_dns(domain_id, params) ⇒ Object
Apply DNS records via the Cloudflare API, then auto-verify. POST /domains/:id/dns/cloudflare — params: { token: "..." }
71 72 73 |
# File 'lib/mailblastr/domains.rb', line 71 def apply_cloudflare_dns(domain_id, params) Client.request(:post, "/domains/#{Client.path_escape(domain_id)}/dns/cloudflare", body: params) end |
.apply_godaddy_dns(domain_id, params) ⇒ Object
Apply DNS records via the GoDaddy API, then auto-verify. POST /domains/:id/dns/godaddy — params: { key: "...", secret: "..." }
77 78 79 |
# File 'lib/mailblastr/domains.rb', line 77 def apply_godaddy_dns(domain_id, params) Client.request(:post, "/domains/#{Client.path_escape(domain_id)}/dns/godaddy", body: params) end |
.apply_namecheap_dns(domain_id, params) ⇒ Object
Apply DNS records via the Namecheap API (existing records preserved),
then auto-verify. POST /domains/:id/dns/namecheap
params: { apiUser: "...", apiKey: "...", userName: "..." } — camelCase,
the same spelling every MailBlastr SDK uses. api_user and api_key
are accepted aliases, and the optional username may also be spelled
username, but there is NO user_name alias: the API ignores that key,
so a username sent under it is silently dropped.
88 89 90 |
# File 'lib/mailblastr/domains.rb', line 88 def apply_namecheap_dns(domain_id, params) Client.request(:post, "/domains/#{Client.path_escape(domain_id)}/dns/namecheap", body: params) end |
.claim(params) ⇒ Object
Claim a domain already verified in another account. POST /domains/claim
49 50 51 |
# File 'lib/mailblastr/domains.rb', line 49 def claim(params) Client.request(:post, "/domains/claim", body: params) end |
.create(params) ⇒ Object
Register a sending domain. POST /domains
7 8 9 |
# File 'lib/mailblastr/domains.rb', line 7 def create(params) Client.request(:post, "/domains", body: params) end |
.delete(domain_id) ⇒ Object
DELETE /domains/:id
93 94 95 |
# File 'lib/mailblastr/domains.rb', line 93 def delete(domain_id) Client.request(:delete, "/domains/#{Client.path_escape(domain_id)}") end |
.detect_dns(domain_id) ⇒ Object
Detect the DNS provider and available one-click apply methods. GET /domains/:id/dns/detect
65 66 67 |
# File 'lib/mailblastr/domains.rb', line 65 def detect_dns(domain_id) Client.request(:get, "/domains/#{Client.path_escape(domain_id)}/dns/detect") end |
.get(domain_id) ⇒ Object
GET /domains/:id
12 13 14 |
# File 'lib/mailblastr/domains.rb', line 12 def get(domain_id) Client.request(:get, "/domains/#{Client.path_escape(domain_id)}") end |
.get_claim(domain_id) ⇒ Object
Retrieve a domain's claim record. GET /domains/:id/claim
54 55 56 |
# File 'lib/mailblastr/domains.rb', line 54 def get_claim(domain_id) Client.request(:get, "/domains/#{Client.path_escape(domain_id)}/claim") end |
.list(params = {}) ⇒ Object
GET /domains — with no pagination params one page carries up to 1,000
domains and has_more reports any truncation; pass limit and walk
after to read past that. Rows still pending a DNS-TXT ownership claim
are excluded; read those through get_claim instead.
20 21 22 |
# File 'lib/mailblastr/domains.rb', line 20 def list(params = {}) Client.request(:get, "/domains", query: Client.pagination(params)) end |
.mx_check(name) ⇒ Object
Check a domain's live MX records before adding receiving.
ours is true only when every MX host is MailBlastr's. A DNS failure
answers { has_mx: false, ours: false, records: [] }, not an error.
GET /domains/mx-check?name=
28 29 30 |
# File 'lib/mailblastr/domains.rb', line 28 def mx_check(name) Client.request(:get, "/domains/mx-check", query: { name: name }) end |
.records_csv(domain_id) ⇒ Object
Download the domain's DNS records as CSV text (a String, not JSON). GET /domains/:id/records.csv
34 35 36 |
# File 'lib/mailblastr/domains.rb', line 34 def records_csv(domain_id) Client.request(:get, "/domains/#{Client.path_escape(domain_id)}/records.csv", raw: true) end |
.update(domain_id, params) ⇒ Object
PATCH /domains/:id (returns the slim ack { object: "domain", id }).
39 40 41 |
# File 'lib/mailblastr/domains.rb', line 39 def update(domain_id, params) Client.request(:patch, "/domains/#{Client.path_escape(domain_id)}", body: params) end |
.verify(domain_id) ⇒ Object
Trigger DNS verification. POST /domains/:id/verify
44 45 46 |
# File 'lib/mailblastr/domains.rb', line 44 def verify(domain_id) Client.request(:post, "/domains/#{Client.path_escape(domain_id)}/verify") end |
.verify_claim(domain_id) ⇒ Object
Verify a domain claim's TXT record. POST /domains/:id/claim/verify
59 60 61 |
# File 'lib/mailblastr/domains.rb', line 59 def verify_claim(domain_id) Client.request(:post, "/domains/#{Client.path_escape(domain_id)}/claim/verify") end |