Class: GlobeSSL::Webservers
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#fetch ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/globessl/webservers.rb', line 6 def fetch @errors.clear @list.clear response = Client.get('/tools/webservers') case response.code when '200' json = response.body hash = JSON.parse(json) hash.each_pair { |key, value| @list << Webserver.new(:id => key, :name => value) } return true when '400', '401', '403' set_errors(response) return false else return false end end |
#set_errors(response) ⇒ Object
26 27 28 29 30 |
# File 'lib/globessl/webservers.rb', line 26 def set_errors(response) json = response.body hash = JSON.parse(json) @errors << hash["message"] end |