Class: DnsServices::Linode

Inherits:
Dnsign::DnsService show all
Defined in:
lib/dnsign/dns_services/linode.rb

Instance Method Summary collapse

Methods inherited from Dnsign::DnsService

create_from_name

Constructor Details

#initialize(opts = {}) ⇒ Linode

Returns a new instance of Linode.


7
8
9
# File 'lib/dnsign/dns_services/linode.rb', line 7

def initialize(opts={})
  @access_token = opts.fetch :access_token
end

Instance Method Details

#retrieve_ip(fqdn) ⇒ Object


24
25
26
27
28
29
30
# File 'lib/dnsign/dns_services/linode.rb', line 24

def retrieve_ip(fqdn)
  record_name, domain_name = split_fqdn fqdn

  if record = fetch_record(domain_name, record_name)
    record.target
  end
end

#update_ip(fqdn, ip) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dnsign/dns_services/linode.rb', line 11

def update_ip(fqdn, ip)
  record_name, domain_name = split_fqdn fqdn

  if record = fetch_record(domain_name, record_name)
    response = update_record(record.domainid, record.resourceid, record_name, ip)
    handle_record_response response, ip
  else
    domain = fetch_domain(domain_name)
    response = create_record(domain.domainid, record_name, ip)
    handle_record_response response, ip
  end
end