Class: Registrar::Provider::OpenSRS::NameServerList

Inherits:
Object
  • Object
show all
Defined in:
lib/registrar/provider/opensrs/name_server_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(purchase_options) ⇒ NameServerList

Returns a new instance of NameServerList.



7
8
9
# File 'lib/registrar/provider/opensrs/name_server_list.rb', line 7

def initialize(purchase_options)
  @nameservers = purchase_options.name_servers
end

Instance Attribute Details

#nameserversObject (readonly)

Returns the value of attribute nameservers.



5
6
7
# File 'lib/registrar/provider/opensrs/name_server_list.rb', line 5

def nameservers
  @nameservers
end

Instance Method Details

#to_xml(context) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/registrar/provider/opensrs/name_server_list.rb', line 11

def to_xml(context)
  context.dt_array do |dt_array|
    @nameservers.each_with_index do |nameserver, index|
      dt_array.item(key: index) do |item|
        item.dt_assoc do |dt_assoc|
          dt_assoc.item(key: 'sortorder') { |item| item.text! "#{index + 1}" }
          dt_assoc.item(key: 'name') {|item| item.text! nameserver.name }
        end
      end
    end
  end
end