Module: Epp::Eis::NssetCommands

Defined in:
lib/epp-eis/nsset.rb

Instance Method Summary collapse

Instance Method Details

#check_nsset(*nssets) ⇒ Object

Check availability for a nsset identification.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/epp-eis/nsset.rb', line 130

def check_nsset(*nssets)
  builder = build_epp_request do |xml|
    xml.command {
      xml.check {
        xml.check('xmlns:nsset' => XML_NS_NSSET, 'xsi:schemaLocation' => XML_NSSET_SCHEMALOC) {
          xml.parent.namespace = xml.parent.namespace_definitions.first
          nssets.each { |nsset| xml['nsset'].id_ nsset }
        }
      }
      xml.clTRID UUIDTools::UUID.timestamp_create.to_s
    }
  end

  NssetCheckResponse.new(send_request(builder.to_xml))
end

#create_nsset(nsset, nameservers, contact) ⇒ Object

Create a new nameserver object



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/epp-eis/nsset.rb', line 147

def create_nsset(nsset, nameservers, contact)
  builder = build_epp_request do |xml|
    xml.command {
      xml.create {
        xml.create('xmlns:nsset' => XML_NS_NSSET, 'xsi:schemaLocation' => XML_NSSET_SCHEMALOC) {
          xml.parent.namespace = xml.parent.namespace_definitions.first
          xml['nsset'].id_ nsset
          nameservers.each do |nameserver|
            xml['nsset'].ns {
              xml['nsset'].name nameserver[0]
              xml['nsset'].addr nameserver[1]
            }
          end
          xml['nsset'].tech contact
        }
      }
      xml.clTRID UUIDTools::UUID.timestamp_create.to_s
    }
  end
  
  NssetCreateResponse.new(send_request(builder.to_xml))
end

#delete_nsset(nsset) ⇒ Object

Delete nameserver object. Can only be deleted if object does not have relations to other objects.



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/epp-eis/nsset.rb', line 171

def delete_nsset(nsset)
  builder = build_epp_request do |xml|
    xml.command {
      xml.delete {
        xml.delete('xmlns:nsset' => XML_NS_NSSET, 'xsi:schemaLocation' => XML_NSSET_SCHEMALOC) {
          xml.parent.namespace = xml.parent.namespace_definitions.first
          xml['nsset'].id_ nsset
        }
      }
      xml.clTRID UUIDTools::UUID.timestamp_create.to_s
    }
  end
  
  NssetDeleteResponse.new(send_request(builder.to_xml))
end

#info_nsset(nsset) ⇒ Object

Returns intormation about existing nameserver object.



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/epp-eis/nsset.rb', line 188

def info_nsset(nsset)
  builder = build_epp_request do |xml|
    xml.command {
      xml.info {
        xml.info('xmlns:nsset' => XML_NS_NSSET, 'xsi:schemaLocation' => XML_NSSET_SCHEMALOC) {
          xml.parent.namespace = xml.parent.namespace_definitions.first
          xml['nsset'].id_ nsset
        }
      }
      xml.clTRID UUIDTools::UUID.timestamp_create.to_s
    }
  end
  
  NssetInfoResponse.new(send_request(builder.to_xml))
end

#list_nssetsObject



204
205
206
# File 'lib/epp-eis/nsset.rb', line 204

def list_nssets
  list_command('listNssets')
end

#update_nsset(nsset, add_nameservers, add_contact, rem_nameserver, rem_contact) ⇒ Object

Updates nameserver object. Update has been divided into three sections. Depending on the section that is used, update can add, remove and/or change data all at once.



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/epp-eis/nsset.rb', line 210

def update_nsset(nsset, add_nameservers, add_contact, rem_nameserver, rem_contact)
  builder = build_epp_request do |xml|
    xml.command {
      xml.update {
        xml.update('xmlns:nsset' => XML_NS_NSSET, 'xsi:schemaLocation' => XML_NSSET_SCHEMALOC) {
          xml.parent.namespace = xml.parent.namespace_definitions.first
          xml['nsset'].id_ nsset
          if add_nameservers or add_contact
            xml['nsset'].add {
              add_nameservers.each do |nameserver|
                xml['nsset'].ns {
                  xml['nsset'].name nameserver[0]
                  xml['nsset'].addr nameserver[1]
                }
              end if add_nameservers
              xml['nsset'].tech add_contact if add_contact
            }
          end
          if rem_nameserver or rem_contact
            xml['nsset'].rem {
              xml['nsset'].name rem_nameserver
              xml['nsset'].tech rem_contact
            }
          end
        }
      }
      xml.clTRID UUIDTools::UUID.timestamp_create.to_s
    }
  end
  
  NssetUpdateResponse.new(send_request(builder.to_xml))
end