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

Instance Attribute Details

#hostObject

Returns the value of attribute host.



9
10
11
# File 'lib/hugo/dns.rb', line 9

def host
  @host
end

Instance Method Details

#data(arg = nil) ⇒ Object



46
47
48
# File 'lib/hugo/dns.rb', line 46

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

#deployObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/hugo/dns.rb', line 11

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.id, hostname, type, ttl, data)
  puts "Successfully configured DNS Host"
end

#domain(arg = nil) ⇒ Object



34
35
36
# File 'lib/hugo/dns.rb', line 34

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

#hostname(arg = nil) ⇒ Object



30
31
32
# File 'lib/hugo/dns.rb', line 30

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

#token(arg = nil) ⇒ Object



26
27
28
# File 'lib/hugo/dns.rb', line 26

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

#ttl(arg = nil) ⇒ Object



42
43
44
# File 'lib/hugo/dns.rb', line 42

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

#type(arg = nil) ⇒ Object



38
39
40
# File 'lib/hugo/dns.rb', line 38

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

#user(arg = nil) ⇒ Object



22
23
24
# File 'lib/hugo/dns.rb', line 22

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