Sha256: d56703b5fdbc6c4fc733c55b2ca2f9f2963b4469cb64b6341cdbd2775ef30665
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
module DNSimple class Client def self.debug? @debug end def self.debug=(debug) @debug = debug end def self.username raise RuntimeError, "You must set your username first: DNSimple::Client.username = 'username'" unless defined?(@@username) @@username end def self.username=(username) @@username = username end def self.password raise RuntimeError, "You must set your password first: DNSimple::Client.password = 'password'" unless defined?(@@password) @@password end def self.password=(password) @@password = password end def self.credentials {:username => self.username, :password => self.password} end def self.base_uri @@base_uri ||= "https://dnsimple.com" end def self.base_uri=(base_uri) @@base_uri = base_uri.gsub(/\/$/, '') end def self.load_credentials(path='~/.dnsimple') credentials = YAML.load(File.new(File.expand_path(path))) self.username = credentials['username'] self.password = credentials['password'] "Credentials loaded from #{path}" end def self.standard_options {:format => :json, :headers => {'Accept' => 'application/json'}} end def self.standard_options_with_credentials standard_options.merge({:basic_auth => credentials}) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dnsimple-ruby-0.9.5 | lib/dnsimple/client.rb |
dnsimple-ruby-0.9.4 | lib/dnsimple/client.rb |