Class: Hugo::Dns

Inherits:
Object
  • Object
show all
Includes:
Mixin::ParamsValidate, Singleton
Defined in:
lib/hugo/dns.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Mixin::ParamsValidate

#set_or_return, #validate

Instance Attribute Details

#hostObject

Returns the value of attribute host.



7
8
9
# File 'lib/hugo/dns.rb', line 7

def host
  @host
end

Instance Method Details

#data(arg = nil) ⇒ Object



52
53
54
# File 'lib/hugo/dns.rb', line 52

def data(arg=nil)
  set_or_return(:data, arg, :kind_of => [String]) 
end

#deployObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/hugo/dns.rb', line 9

def deploy

  # Initialize Resouce
  Zerigo::DNS::Base.user = user
  Zerigo::DNS::Base.password = token

  # find or create domain
  zone = Zerigo::DNS::Zone.find_or_create(domain)

  # find or create host
  host = Zerigo::DNS::Host.update_or_create(
        :zone     => zone.id, 
        :host     => hostname, 
        :type     => type,
        :ttl      => ttl,
        :data     => data  
    )
end

#domain(arg = nil) ⇒ Object



40
41
42
# File 'lib/hugo/dns.rb', line 40

def domain(arg=nil)
  set_or_return(:domain, arg, :kind_of => [String]) 
end

#hostname(arg = nil) ⇒ Object



36
37
38
# File 'lib/hugo/dns.rb', line 36

def hostname(arg=nil)
  set_or_return(:hostname, arg, :kind_of => [String]) 
end

#token(arg = nil) ⇒ Object



32
33
34
# File 'lib/hugo/dns.rb', line 32

def token(arg=nil)
  set_or_return(:token, arg, :kind_of => [String]) 
end

#ttl(arg = nil) ⇒ Object



48
49
50
# File 'lib/hugo/dns.rb', line 48

def ttl(arg=nil)
  set_or_return(:ttl, arg, :kind_of => [Integer]) 
end

#type(arg = nil) ⇒ Object



44
45
46
# File 'lib/hugo/dns.rb', line 44

def type(arg=nil)
  set_or_return(:type, arg, :kind_of => [String]) 
end

#user(arg = nil) ⇒ Object



28
29
30
# File 'lib/hugo/dns.rb', line 28

def user(arg=nil)
  set_or_return(:user, arg, :kind_of => [String]) 
end