class GlobeSSL::AccountBalance

Public Instance Methods

fetch() click to toggle source
# File lib/globessl/account_balance.rb, line 7
def fetch
  @errors.clear
  
  response = Client.get('/account/balance')
  
  case response.code
  when '200'  
    json = response.body
    hash = JSON.parse(json)

    @balance  = hash["balance"]
    @currency = hash["currency"]
    
    return true
  when '400', '401', '403'
    set_errors(response)
    return false
  else
    return false
  end
end
set_errors(response) click to toggle source
# File lib/globessl/account_balance.rb, line 29
def set_errors(response)
  json = response.body
  hash = JSON.parse(json)
  @errors << hash["message"]
end