Module: DnsMadeEasy
- Defined in:
- lib/dnsmadeeasy.rb,
lib/dnsmadeeasy.rb,
lib/dnsmadeeasy/types.rb,
lib/dnsmadeeasy/runner.rb,
lib/dnsmadeeasy/version.rb,
lib/dnsmadeeasy/cli/input.rb,
lib/dnsmadeeasy/zone/diff.rb,
lib/dnsmadeeasy/zone/file.rb,
lib/dnsmadeeasy/zone/plan.rb,
lib/dnsmadeeasy/api/client.rb,
lib/dnsmadeeasy/credentials.rb,
lib/dnsmadeeasy/zone/parser.rb,
lib/dnsmadeeasy/zone/record.rb,
lib/dnsmadeeasy/cli/commands.rb,
lib/dnsmadeeasy/cli/launcher.rb,
lib/dnsmadeeasy/cli/box_output.rb,
lib/dnsmadeeasy/zone/record_set.rb,
lib/dnsmadeeasy/zone/serializer.rb,
lib/dnsmadeeasy/zone/plan_action.rb,
lib/dnsmadeeasy/cli/commands/base.rb,
lib/dnsmadeeasy/cli/commands/zone.rb,
lib/dnsmadeeasy/zone/apply_result.rb,
lib/dnsmadeeasy/cli/reported_error.rb,
lib/dnsmadeeasy/zone/plan_renderer.rb,
lib/dnsmadeeasy/cli/message_helpers.rb,
lib/dnsmadeeasy/zone/apply_executor.rb,
lib/dnsmadeeasy/zone/remote_adapter.rb,
lib/dnsmadeeasy/zone/remote_records.rb,
lib/dnsmadeeasy/cli/commands/account.rb,
lib/dnsmadeeasy/cli/commands/version.rb,
lib/dnsmadeeasy/credentials/api_keys.rb,
lib/dnsmadeeasy/zone/aname_flattener.rb,
lib/dnsmadeeasy/zone/provider_record.rb,
lib/dnsmadeeasy/credentials/yaml_file.rb,
lib/dnsmadeeasy/cli/commands/legacy_operation.rb
Defined Under Namespace
Modules: Api, CLI, Credentials, Types, Zone
Classes: APIKeyAndSecretMissingError, AbstractMethodError, AuthenticationError, Error, InvalidCredentialKeys, InvalidCredentialsFormatError, NoDomainError, NoSuchAccountError, Runner
Constant Summary
collapse
- API_BASE_URL_PRODUCTION =
'https://api.dnsmadeeasy.com/V2.0'
- API_BASE_URL_SANDBOX =
'https://api.sandbox.dnsmadeeasy.com/V2.0'
- VERSION =
Version 1.0+ is supporting zone file manipulation
'1.0.1'
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.default_api_key ⇒ Object
Returns the value of attribute default_api_key.
55
56
57
|
# File 'lib/dnsmadeeasy.rb', line 55
def default_api_key
@default_api_key
end
|
.default_api_secret ⇒ Object
Returns the value of attribute default_api_secret.
55
56
57
|
# File 'lib/dnsmadeeasy.rb', line 55
def default_api_secret
@default_api_secret
end
|
Class Method Details
.api_key ⇒ Object
90
91
92
|
# File 'lib/dnsmadeeasy.rb', line 90
def api_key
default_api_key
end
|
.api_key=(value) ⇒ Object
86
87
88
|
# File 'lib/dnsmadeeasy.rb', line 86
def api_key=(value)
self.default_api_key = value
end
|
.api_secret ⇒ Object
98
99
100
|
# File 'lib/dnsmadeeasy.rb', line 98
def api_secret
default_api_secret
end
|
.api_secret=(value) ⇒ Object
94
95
96
|
# File 'lib/dnsmadeeasy.rb', line 94
def api_secret=(value)
self.default_api_secret = value
end
|
.client ⇒ Object
102
103
104
|
# File 'lib/dnsmadeeasy.rb', line 102
def client(**)
@client ||= create_client(false, **)
end
|
58
59
60
|
# File 'lib/dnsmadeeasy.rb', line 58
def configure
yield(self) if block_given?
end
|
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/dnsmadeeasy.rb', line 62
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.fetch('USER', nil)),
account: account,
encryption_key: encryption_key
)
raise APIKeyAndSecretMissingError, "Unable to load valid api keys from #{file}!" unless credentials
configure do |config|
config.api_key = credentials.api_key
config.api_secret = credentials.api_secret
end
end
|
.create_client(sandbox = false, api_key: default_api_key, api_secret: default_api_secret) ⇒ Object
110
111
112
113
114
115
116
117
118
|
# File 'lib/dnsmadeeasy.rb', line 110
def create_client(sandbox = false,
api_key: default_api_key,
api_secret: default_api_secret,
**)
raise APIKeyAndSecretMissingError, 'Please set #api_key and #api_secret' unless api_key && api_secret
::DnsMadeEasy::Api::Client.new(api_key, api_secret, sandbox, **)
end
|
.credentials_from_file(file: DnsMadeEasy::Credentials.default_credentials_path, account: nil, encryption_key: nil) ⇒ Object
.method_missing(method) ⇒ Object
Basically delegate it all to the Client instance
if the method call is supported.
123
124
125
126
127
128
129
|
# File 'lib/dnsmadeeasy.rb', line 123
def method_missing(method, ...)
if client.respond_to?(method)
client.send(method, ...)
else
super
end
end
|
.respond_to_missing?(method, include_private = false) ⇒ Boolean
131
132
133
134
135
|
# File 'lib/dnsmadeeasy.rb', line 131
def respond_to_missing?(method, include_private = false)
client.respond_to?(method, include_private) || super
rescue APIKeyAndSecretMissingError
super
end
|
.sandbox_client ⇒ Object
106
107
108
|
# File 'lib/dnsmadeeasy.rb', line 106
def sandbox_client(**)
@sandbox_client ||= create_client(true, **)
end
|