Class: DynDynDong::ZoneEdit

Inherits:
Service
  • Object
show all
Defined in:
lib/dyndyndong/services/zoneedit.rb

Instance Method Summary collapse

Methods inherited from Service

each, #fetch, inherited, instances, #method_missing, services

Constructor Details

#initialize(*args) ⇒ ZoneEdit

Returns a new instance of ZoneEdit.



23
24
25
26
27
# File 'lib/dyndyndong/services/zoneedit.rb', line 23

def initialize(*args)
  @user = nil
  @pass = nil
  super(*args)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class DynDynDong::Service

Instance Method Details

#alias_host(h) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/dyndyndong/services/zoneedit.rb', line 50

def alias_host(h)
  Net::HTTP.start('dynamic.zoneedit.com') {|http|
    req = Net::HTTP::Get.new('/auth/dynamic.html?host=%s' % [URI.escape(h)])
    req.basic_auth @user, @pass
    http.request(req)
    "DONE"
  }
end

#host(h) ⇒ Object



40
41
42
# File 'lib/dyndyndong/services/zoneedit.rb', line 40

def host(h)
  @hosts << h.to_s
end

#password(p) ⇒ Object Also known as: password=



33
34
35
# File 'lib/dyndyndong/services/zoneedit.rb', line 33

def password(p)
  @pass = p.to_s
end

#prefetchObject



44
45
46
47
48
# File 'lib/dyndyndong/services/zoneedit.rb', line 44

def prefetch
  if !(@user and @pass)
    raise "username or password ungiven"
  end
end

#username(u) ⇒ Object Also known as: username=



29
30
31
# File 'lib/dyndyndong/services/zoneedit.rb', line 29

def username(u)
  @user = u.to_s
end