6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/internetbs/registry_status.rb', line 6
def fetch
ensure_attribute_has_value :domain
return false if @errors.any?
params = {'domain' => @domain}
response = Client.get('/domain/registrystatus', params)
code = response.code rescue ""
case code
when '200'
hash = JSON.parse(response.body)
@status = hash['status']
@transaction_id = hash['transactid']
if @status == 'SUCCESS'
if hash['registrystatus'].is_a?(Array)
@registry_status = hash['registrystatus'].first
else
@registry_status = hash['registrystatus']
end
else
set_errors(response)
return false
end
return true
else
set_errors(response)
return false
end
end
|