lib/fog/dns/dnsimple.rb in fog-0.8.1 vs lib/fog/dns/dnsimple.rb in fog-0.8.2
- old
+ new
@@ -1,11 +1,11 @@
module Fog
module DNSimple
class DNS < Fog::Service
requires :dnsimple_email, :dnsimple_password
- recognizes :host, :path, :port, :scheme, :persistent
+ recognizes :dnsimple_url, :host, :path, :port, :scheme, :persistent
recognizes :provider # remove post deprecation
model_path 'fog/dns/models/dnsimple'
model :record
collection :records
@@ -29,26 +29,32 @@
@data ||= Hash.new do |hash, key|
hash[key] = {}
end
end
+ def self.reset
+ @data = nil
+ end
+
def initialize(options={})
unless options.delete(:provider)
location = caller.first
warning = "[yellow][WARN] Fog::DNS::DNSimple.new is deprecated, use Fog::DNS.new(:provider => 'DNSimple') instead[/]"
warning << " [light_black](" << location << ")[/] "
Formatador.display_line(warning)
end
@dnsimple_email = options[:dnsimple_email]
@dnsimple_password = options[:dnsimple_password]
- @data = self.class.data[@dnsimple_email]
end
+ def data
+ self.class.data[@dnsimple_email]
+ end
+
def reset_data
self.class.data.delete(@dnsimple_email)
- @data = self.class.data[@dnsimple_email]
end
end
class Real
@@ -63,9 +69,15 @@
require 'json'
@dnsimple_email = options[:dnsimple_email]
@dnsimple_password = options[:dnsimple_password]
+ if options[:dnsimple_url]
+ uri = URI.parse(options[:dnsimple_url])
+ options[:host] = uri.host
+ options[:port] = uri.port
+ options[:scheme] = uri.scheme
+ end
@host = options[:host] || "dnsimple.com"
@port = options[:port] || 443
@scheme = options[:scheme] || 'https'
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", options[:persistent])
end