class Proxy::Dns::GloboDNS::Record
Attributes
auth_token[R]
host[R]
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
# File lib/smart_proxy_dns_globodns/dns_globodns_main.rb, line 19 def initialize options = {} @auth_token = options[:auth_token] @host = options[:host] raise "dns_globodns provider needs 'auth_token' and 'host' options" unless @auth_token && @host super(options) end
record(attrs = {})
click to toggle source
# File lib/smart_proxy_dns_globodns/dns_globodns_main.rb, line 12 def self.record(attrs = {}) new(attrs.merge( :auth_token => ::Proxy::Dns::GloboDNS::Plugin.settings.auth_token, :host => ::Proxy::Dns::GloboDNS::Plugin.settings.host, )) end
Public Instance Methods
create()
click to toggle source
# File lib/smart_proxy_dns_globodns/dns_globodns_main.rb, line 26 def create if @type.eql?('A') query = @fqdn value = @value elsif @type.eql?('PTR') query = @value value = @fqdn else raise "Not Implemented" end begin conn.new_record(query, @type, value) rescue GlobodnsClient::AlreadyExists raise(Proxy::Dns::Collision, "#{@fqdn} is already used") end true end
remove()
click to toggle source
# File lib/smart_proxy_dns_globodns/dns_globodns_main.rb, line 44 def remove query = @type.eql?('A') ? @fqdn : @value begin conn.delete_record(query, @type) rescue GlobodnsClient::NotFound raise(Proxy::Dns::NotFound, "#{@fqdn} not found") end true end
Private Instance Methods
conn()
click to toggle source
# File lib/smart_proxy_dns_globodns/dns_globodns_main.rb, line 56 def conn @conn ||= GlobodnsClient::Connection.new(auth_token: @auth_token, host: @host) end