Class: InternetBS::PrivateWhois

Inherits:
Base
  • Object
show all
Defined in:
lib/internetbs/private_whois.rb

Instance Method Summary collapse

Methods inherited from Base

#inspect

Instance Method Details

#disableObject



6
7
8
# File 'lib/internetbs/private_whois.rb', line 6

def disable
  set_private_whois_status :disable
end

#enableObject



10
11
12
# File 'lib/internetbs/private_whois.rb', line 10

def enable
  set_private_whois_status :enable
end

#fetchObject



14
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
# File 'lib/internetbs/private_whois.rb', line 14

def fetch
  ensure_attribute_has_value :domain
  return false if @errors.any?
  
  params = {'domain' => @domain}
  response = Client.get('/domain/privatewhois/status', params)
  code = response.code rescue ""
  
  case code
  when '200'
    hash = JSON.parse(response.body)

    @status = hash['status']
    @transaction_id = hash['transactid']
    
    if @status == 'SUCCESS'
      @privacy_status = hash['privatewhoisstatus']
    else
      set_errors(response)
      return false
    end
            
    return true
  else
    set_errors(response)
    return false
  end
end