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



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

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

#client_idObject



38
39
40
# File 'lib/epp-client/domain/info_response.rb', line 38

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



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

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

#creator_idObject



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

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

#expiration_dateObject



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

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

#hostsObject



35
36
37
# File 'lib/epp-client/domain/info_response.rb', line 35

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
# 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' => hostAttr.find('domain:name').first.content.strip,
        'ipv4' => hostAttr.find('domain:addr[@ip="v4"]').first.content.strip,
        'ipv6' => hostAttr.find('domain:addr[@ip="v6"]').first.content.strip }
    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 ||= value_for_xpath('//domain:status/@s')
end

#transfer_dateObject



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

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

#updated_dateObject



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

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

#updator_idObject



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

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