module DnsMadeEasy
Constants
- API_BASE_URL_PRODUCTION
- API_BASE_URL_SANDBOX
- VERSION
Attributes
default_api_key[RW]
default_api_secret[RW]
Public Class Methods
api_key=(value)
click to toggle source
# File lib/dnsmadeeasy.rb, line 66 def api_key=(value) self.default_api_key = value end
api_secret=(value)
click to toggle source
# File lib/dnsmadeeasy.rb, line 70 def api_secret=(value) self.default_api_secret = value end
client(**options)
click to toggle source
# File lib/dnsmadeeasy.rb, line 74 def client(**options) @client ||= create_client(false, **options) end
configure() { |self| ... }
click to toggle source
# File lib/dnsmadeeasy.rb, line 34 def configure yield(self) if block_given? end
configure_from_file(file = nil, account = nil, encryption_key = nil)
click to toggle source
# File lib/dnsmadeeasy.rb, line 38 def configure_from_file(file = nil, account = nil, encryption_key = nil) credentials = ::DnsMadeEasy::Credentials.keys_from_file( file: file || ::DnsMadeEasy::Credentials.default_credentials_path(user: ENV['USER']), account: account, encryption_key: encryption_key ) if credentials configure do |config| config.api_key = credentials.api_key config.api_secret = credentials.api_secret end else raise APIKeyAndSecretMissingError, "Unable to load valid api keys from #{file}!" end end
create_client(sandbox = false, api_key: default_api_key, api_secret: default_api_secret, **options)
click to toggle source
# File lib/dnsmadeeasy.rb, line 82 def create_client(sandbox = false, api_key: default_api_key, api_secret: default_api_secret, **options) raise APIKeyAndSecretMissingError, 'Please set #api_key and #api_secret' unless api_key && api_secret ::DnsMadeEasy::Api::Client.new(api_key, api_secret, sandbox, **options) end
credentials_from_file(file: DnsMadeEasy::Credentials.default_credentials_path, account: nil, encryption_key: nil)
click to toggle source
# File lib/dnsmadeeasy.rb, line 57 def credentials_from_file(file: DnsMadeEasy::Credentials.default_credentials_path, account: nil, encryption_key: nil) DnsMadeEasy::Credentials.keys_from_file file: file, account: account, encryption_key: encryption_key end
method_missing(method, *args, &block)
click to toggle source
Basically delegate it all to the Client instance if the method call is supported.
Calls superclass method
# File lib/dnsmadeeasy.rb, line 95 def method_missing(method, *args, &block) if client.respond_to?(method) client.send(method, *args, &block) else super(method, *args, &block) end end
sandbox_client(**options)
click to toggle source
# File lib/dnsmadeeasy.rb, line 78 def sandbox_client(**options) @sandbox_client ||= create_client(true, **options) end