module DLDInternet::OpenSRS::API::Domain::MixIns::Get::GetDomain

Public Instance Methods

GetDomainList(cookiep=nil, attr='domain_list') click to toggle source

noinspection RubyUnnecessaryReturnValue

# File lib/dldinternet/opensrs/api/domain/mixins/get/getdomain.rb, line 17
def GetDomainList(cookiep=nil, attr='domain_list')

  list = []
  limit = 25
  pn = 0
  pgnos = nil
  page = getdomainpage(nil, cookiep || cookie, nil, nil, limit)
  while page
    list += page[attr]
    pgnos ||= page['count'].to_i/limit
    if page['remainder'].eql?('1') && pn < pgnos
      pn += 1
      page = getdomainpage(nil, cookiep || cookie, nil, pn, limit)
    else
      page = nil
    end
  end
  list
end
GetDomainListExt(cookiep=nil) click to toggle source

noinspection RubyUnnecessaryReturnValue

# File lib/dldinternet/opensrs/api/domain/mixins/get/getdomain.rb, line 12
def GetDomainListExt(cookiep=nil)
  GetDomainList(cookiep, 'ext_results')
end

Private Instance Methods

getdomainpage(domain=nil,cookiep=nil,registrant_ip=nil, page=nil, limit=nil) click to toggle source

noinspection RubyUnnecessaryReturnValue

# File lib/dldinternet/opensrs/api/domain/mixins/get/getdomain.rb, line 40
def getdomainpage(domain=nil,cookiep=nil,registrant_ip=nil, page=nil, limit=nil)

  data = {
      object: 'DOMAIN',
      action: 'GET',
      attributes: {
          type: 'list',
      },
  }
  data[:cookie]             = cookiep if cookiep
  data[:domain]             = domain if domain
  data[:registrant_ip]      = registrant_ip if registrant_ip
  data[:attributes][:limit] = limit if limit
  data[:attributes][:page]  = page if page

  response = server.call(data)
  return nil unless response.success
  resp_obj = response.response
  return nil unless resp_obj
  resp_obj['attributes']
end