Module: Pepper::Commands::ClassMethods

Defined in:
lib/pepper/commands.rb

Instance Method Summary collapse

Instance Method Details

#check(*domains) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/pepper/commands.rb', line 35

def check(*domains)
   unless @logged_in
  builder = Nokogiri::XML::Builder.new do |xml|
    xml.epp("xmlns"              => "urn:ietf:params:xml:ns:epp-1.0", 
            "xmlns:xsi"          => "http://www.w3.org/2001/XMLSchema-instance",
            "xsi:schemaLocation" => "urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" ) {
      xml.command {
        xml.check {
          xml.check("xmlns:domain"       => "http://www.nominet.org.uk/epp/xml/nom-domain-2.0",
                    "xsi:schemaLocation" => "http://www.nominet.org.uk/epp/xml/nom-domain-2.0 nom-domain-2.0.xsd") {
            xml.parent.namespace = xml.parent.namespace_definitions.first
            domains.each {|d|
              xml["domain"].name d
            }
          }
        }
      }
    }
  end
  r = self.write( builder.to_xml )
  r.response.resdata.chkdata.domain_names.inject({}){|hash,domain|
    hash.merge( domain => r.response.resdata.chkdata.domain_names_avail.shift == "1")
  }
end

#loginObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/pepper/commands.rb', line 9

def 
  unless @logged_in
    builder = Nokogiri::XML::Builder.new do |xml|
      xml.epp("xmlns"              => "urn:ietf:params:xml:ns:epp-1.0", 
              "xmlns:xsi"          => "http://www.w3.org/2001/XMLSchema-instance",
              "xsi:schemaLocation" => "urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd" ) {
        xml.command {
          xml. {
            xml.clID @tag
            xml.pw   @password
            xml.options {
              xml.version "1.0"
              xml.lang    "en"
            }
            xml.svcs {
              xml.objURI "http://www.nominet.org.uk/epp/xml/nom-domain-2.0"
            }
          }
        }
      }
    end
    r = self.write( builder.to_xml )
  end
  @logged_in = true
end