Class: VagrantPlugins::DnsUpdater::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::DnsUpdater::Config
- Defined in:
- lib/vagrant-dns-updater/config.rb
Instance Attribute Summary collapse
-
#appkey ⇒ Object
Returns the value of attribute appkey.
-
#appsecret ⇒ Object
Returns the value of attribute appsecret.
-
#consumerkey ⇒ Object
Returns the value of attribute consumerkey.
-
#interface ⇒ Object
Returns the value of attribute interface.
-
#registrar ⇒ Object
Returns the value of attribute registrar.
-
#subdomain ⇒ Object
Returns the value of attribute subdomain.
-
#ttl ⇒ Object
Returns the value of attribute ttl.
-
#zone ⇒ Object
Returns the value of attribute zone.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/vagrant-dns-updater/config.rb', line 16 def initialize @registrar = UNSET_VALUE @appkey = UNSET_VALUE @appsecret = UNSET_VALUE @consumerkey = UNSET_VALUE @zone = UNSET_VALUE @subdomain = UNSET_VALUE @interface = UNSET_VALUE @ttl = UNSET_VALUE end |
Instance Attribute Details
#appkey ⇒ Object
Returns the value of attribute appkey.
7 8 9 |
# File 'lib/vagrant-dns-updater/config.rb', line 7 def appkey @appkey end |
#appsecret ⇒ Object
Returns the value of attribute appsecret.
8 9 10 |
# File 'lib/vagrant-dns-updater/config.rb', line 8 def appsecret @appsecret end |
#consumerkey ⇒ Object
Returns the value of attribute consumerkey.
9 10 11 |
# File 'lib/vagrant-dns-updater/config.rb', line 9 def consumerkey @consumerkey end |
#interface ⇒ Object
Returns the value of attribute interface.
12 13 14 |
# File 'lib/vagrant-dns-updater/config.rb', line 12 def interface @interface end |
#registrar ⇒ Object
Returns the value of attribute registrar.
6 7 8 |
# File 'lib/vagrant-dns-updater/config.rb', line 6 def registrar @registrar end |
#subdomain ⇒ Object
Returns the value of attribute subdomain.
11 12 13 |
# File 'lib/vagrant-dns-updater/config.rb', line 11 def subdomain @subdomain end |
#ttl ⇒ Object
Returns the value of attribute ttl.
13 14 15 |
# File 'lib/vagrant-dns-updater/config.rb', line 13 def ttl @ttl end |
#zone ⇒ Object
Returns the value of attribute zone.
10 11 12 |
# File 'lib/vagrant-dns-updater/config.rb', line 10 def zone @zone end |
Instance Method Details
#finalize! ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vagrant-dns-updater/config.rb', line 27 def finalize! @registrar = nil if @registrar == UNSET_VALUE @appkey = nil if @appkey == UNSET_VALUE @appsecret = nil if @appsecret == UNSET_VALUE @consumerkey = nil if @consumerkey == UNSET_VALUE @zone = nil if @zone == UNSET_VALUE @subdomain = nil if @subdomain == UNSET_VALUE @interface = nil if @interface == UNSET_VALUE @ttl = 60 if @ttl == UNSET_VALUE end |
#validate(machine) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/vagrant-dns-updater/config.rb', line 38 def validate(machine) finalize! errors = [] errors << 'appkey parameter is required' if @appkey.nil? && @registrar == 'ovh' errors << 'appsecret parameter is required' if @appsecret.nil? && @registrar == 'ovh' errors << 'consumerkey parameter is required' if @consumerkey.nil? && @registrar == 'ovh' errors << 'zone parameter is required' if @zone.nil? && !@registrar.nil? errors << 'subdomain parameter is required' if @subdomain.nil? && !@registrar.nil? errors << 'interface parameter is required' if @interface.nil? && !@registrar.nil? { "DnsUpdater" => errors } end |