Class: Zonesync::Provider

Inherits:
Struct
  • Object
show all
Defined in:
lib/zonesync/provider.rb

Direct Known Subclasses

Cloudflare, Filesystem, Memory

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#credentialsObject

Returns the value of attribute credentials

Returns:

  • (Object)

    the current value of credentials



5
6
7
# File 'lib/zonesync/provider.rb', line 5

def credentials
  @credentials
end

Class Method Details

.from(credentials) ⇒ Object



6
7
8
9
# File 'lib/zonesync/provider.rb', line 6

def self.from credentials
  return credentials if credentials.is_a?(Provider)
  Zonesync.const_get(credentials[:provider]).new(credentials)
end

Instance Method Details

#add(record) ⇒ Object

Raises:

  • (NotImplementedError)


45
46
47
# File 'lib/zonesync/provider.rb', line 45

def add record
  raise NotImplementedError
end

#change(old_record, new_record) ⇒ Object

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/zonesync/provider.rb', line 41

def change old_record, new_record
  raise NotImplementedError
end

#diffable_recordsObject



11
12
13
14
15
16
17
18
19
# File 'lib/zonesync/provider.rb', line 11

def diffable_records
  zonefile.records.map do |record|
    Record.from_dns_zonefile_record(record)
  end.select do |record|
    %w[A AAAA CNAME MX TXT SPF NAPTR PTR].include?(record.type)
  end.reject do |record|
    record.comment.to_s.downcase.include? "zonesync: ignore"
  end.sort
end

#read(record) ⇒ Object

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/zonesync/provider.rb', line 29

def read record
  raise NotImplementedError
end

#remove(record) ⇒ Object

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/zonesync/provider.rb', line 37

def remove record
  raise NotImplementedError
end

#write(text) ⇒ Object

Raises:

  • (NotImplementedError)


33
34
35
# File 'lib/zonesync/provider.rb', line 33

def write text
  raise NotImplementedError
end