Class: EPP::Domain::InfoResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/epp-client/domain/info_response.rb

Instance Method Summary collapse

Methods inherited from Response

#initialize, #method, #method_missing, #respond_to?, #respond_to_missing?

Methods included from ResponseHelper

#nodes_for_xpath, #value_for_xpath, #values_for_xpath

Constructor Details

This class inherits a constructor from EPP::Domain::Response

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class EPP::Domain::Response

Instance Method Details

#auth_infoObject



65
66
67
68
69
# File 'lib/epp-client/domain/info_response.rb', line 65

def auth_info
  @auth_info ||= begin
    { 'pw' => value_for_xpath('//domain:authInfo/domain:pw') }
  end
end

#client_idObject



44
45
46
# File 'lib/epp-client/domain/info_response.rb', line 44

def client_id
  @clid ||= value_for_xpath('//domain:clID')
end

#contactsObject



18
19
20
21
22
23
# File 'lib/epp-client/domain/info_response.rb', line 18

def contacts
  @contacts ||= nodes_for_xpath('//domain:contact').inject({}) do |hash, node|
    hash[node['type'].to_s] = node.content.strip
    hash
  end
end

#created_dateObject



50
51
52
# File 'lib/epp-client/domain/info_response.rb', line 50

def created_date
  @crdate ||= value_for_xpath('//domain:crDate') && Time.parse(value_for_xpath('//domain:crDate'))
end

#creator_idObject



47
48
49
# File 'lib/epp-client/domain/info_response.rb', line 47

def creator_id
  @crid ||= value_for_xpath('//domain:crID')
end

#expiration_dateObject



59
60
61
# File 'lib/epp-client/domain/info_response.rb', line 59

def expiration_date
  @exdate ||= value_for_xpath('//domain:exDate') && Time.parse(value_for_xpath('//domain:exDate'))
end

#hostsObject



41
42
43
# File 'lib/epp-client/domain/info_response.rb', line 41

def hosts
  @hosts ||= values_for_xpath('//domain:host')
end

#nameObject



6
7
8
# File 'lib/epp-client/domain/info_response.rb', line 6

def name
  @name ||= value_for_xpath('//domain:name')
end

#nameserversObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/epp-client/domain/info_response.rb', line 24

def nameservers
  @nameservers ||= nodes_for_xpath('//domain:ns').map do |ns_node|
    ns = ns_node.find('domain:hostAttr', namespaces).map do |hostAttr|
      name_node = hostAttr.find('domain:hostName').first
      ipv4_node = hostAttr.find('domain:hostAddr[@ip="v4"]').first
      ipv6_node = hostAttr.find('domain:hostAddr[@ip="v6"]').first

      {}.tap do |result|
        result['name']= name_node.content.strip if name_node
        result['ipv4']= ipv4_node.content.strip if ipv4_node
        result['ipv6']= ipv6_node.content.strip if ipv6_node
      end
    end

    ns + ns_node.find('domain:hostObj').map { |n| { 'name' => n.content.strip } }
  end.flatten
end

#registrantObject



15
16
17
# File 'lib/epp-client/domain/info_response.rb', line 15

def registrant
  @registrant ||= value_for_xpath('//domain:registrant')
end

#roidObject



9
10
11
# File 'lib/epp-client/domain/info_response.rb', line 9

def roid
  @roid ||= value_for_xpath('//domain:roid')
end

#statusObject



12
13
14
# File 'lib/epp-client/domain/info_response.rb', line 12

def status
  @status ||= values_for_xpath('//domain:status/@s')
end

#transfer_dateObject



62
63
64
# File 'lib/epp-client/domain/info_response.rb', line 62

def transfer_date
  @trdate ||= value_for_xpath('//domain:trDate') && Time.parse(value_for_xpath('//domain:trDate'))
end

#updated_dateObject



56
57
58
# File 'lib/epp-client/domain/info_response.rb', line 56

def updated_date
  @update ||= value_for_xpath('//domain:upDate') && Time.parse(value_for_xpath('//domain:upDate'))
end

#updator_idObject



53
54
55
# File 'lib/epp-client/domain/info_response.rb', line 53

def updator_id
  @upid ||= value_for_xpath('//domain:upID')
end