15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/internetbs/account_domains.rb', line 15
def fetch
@errors.clear
@list.clear
@total_domains = 0
@total_domains_by_tld = 0
params = {'compactlist' => @compact_list ? 'YES' : 'NO', 'sortby' => @sort_by}
params.merge!({'expiringonly' => @expiring_only}) if @expiring_only
params.merge!({'extensionfilter' => @extension_filter}) if @extension_filter
params.merge!({'pendingtransferonly' => 'YES'}) if @pending_transfer_only
params.merge!({'rangefrom' => @range_from, 'rangeto' => @range_to}) if @range_from && @range_to
params.merge!({'searchtermfilter' => @search_term_filter}) if @search_term_filter
response = Client.get('/domain/list', params)
code = response.code rescue ""
case code
when '200'
hash = JSON.parse(response.body)
@status = hash.delete('status')
@transaction_id = hash.delete('transactid')
if @status == 'SUCCESS'
@total_domains = hash['domaincount']
if @compact_list
hash['domain'].each do |domain|
@list << AccountDomain.new(:name => domain)
end
else
hash['domain'].each do |domain|
@list << AccountDomain.new(
:name => domain['name'],
:expiration_date => domain['expiration'],
:registrar_lock => domain['registrarlock'],
:status => domain['status'],
:transfer_auth_info => domain['transferauthinfo']
)
end
end
else
set_errors(response)
return false
end
return true
else
set_errors(response)
return false
end
end
|