Module: Mailblastr::Domains

Defined in:
lib/mailblastr/domains.rb

Class Method Summary collapse

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: "..." }



70
71
72
# File 'lib/mailblastr/domains.rb', line 70

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: "..." }



76
77
78
# File 'lib/mailblastr/domains.rb', line 76

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: { api_user: "...", api_key: "...", user_name: "..." } — the camelCase spellings (apiUser/apiKey/userName) are accepted too.



84
85
86
# File 'lib/mailblastr/domains.rb', line 84

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



48
49
50
# File 'lib/mailblastr/domains.rb', line 48

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



89
90
91
# File 'lib/mailblastr/domains.rb', line 89

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



64
65
66
# File 'lib/mailblastr/domains.rb', line 64

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



53
54
55
# File 'lib/mailblastr/domains.rb', line 53

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 every domain is returned. Rows still pending a DNS-TXT ownership claim are excluded; read those through get_claim instead.



19
20
21
# File 'lib/mailblastr/domains.rb', line 19

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=



27
28
29
# File 'lib/mailblastr/domains.rb', line 27

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



33
34
35
# File 'lib/mailblastr/domains.rb', line 33

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 }).



38
39
40
# File 'lib/mailblastr/domains.rb', line 38

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



43
44
45
# File 'lib/mailblastr/domains.rb', line 43

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



58
59
60
# File 'lib/mailblastr/domains.rb', line 58

def verify_claim(domain_id)
  Client.request(:post, "/domains/#{Client.path_escape(domain_id)}/claim/verify")
end