Class: NominetEPP::Custom::List

Inherits:
NominetEPP::CustomRequest show all
Defined in:
lib/nominet-epp/requests/custom/list.rb

Constant Summary collapse

NAMESPACE =
'http://www.nominet.org.uk/epp/xml/std-list-1.0'

Instance Attribute Summary

Attributes inherited from Request

#command, #extension

Instance Method Summary collapse

Methods inherited from NominetEPP::CustomRequest

#command, #namespaces, #schemaLocation, #schema_name, #set_namespaces, #x_namespace, #x_node, #x_schemaLocation

Methods inherited from Request

#namespaces, #xml_namespace, #xml_node

Constructor Details

#initialize(type, month) ⇒ List

Returns a new instance of List.



6
7
8
9
10
# File 'lib/nominet-epp/requests/custom/list.rb', line 6

def initialize(type, month)
  month = month.strftime('%Y-%m') if month.respond_to?(:strftime)
  @month = month
  @type  = type
end

Instance Method Details

#command_nameObject



12
13
14
# File 'lib/nominet-epp/requests/custom/list.rb', line 12

def command_name
  'info'
end

#namespace_nameObject



15
16
17
# File 'lib/nominet-epp/requests/custom/list.rb', line 15

def namespace_name
  'l'
end

#namespace_uriObject



18
19
20
# File 'lib/nominet-epp/requests/custom/list.rb', line 18

def namespace_uri
  NAMESPACE
end

#to_xmlObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/nominet-epp/requests/custom/list.rb', line 22

def to_xml
  @namespaces ||= {}
  node = x_node('list')
  x_schemaLocation(node)

  case @type
  when :registration, 'registration', :month, 'month'
    node << x_node('month', @month)
  when :expiry, 'expiry'
    node << x_node('expiry', @month)
  end

  node
end