class GlobeSSL::AccountDetails

Public Instance Methods

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

    @status        = hash["status"]
    @account_id    = hash["account_id"]
    @balance       = hash["balance"]
    @total_balance = hash["total_balance"]
    @account_type  = hash["account_type"]
    @email_address = hash["email"]
    @name          = hash["name"]
    @company       = hash["company"]
    @address       = hash["address"]
    @city          = hash["city"]
    @state         = hash["state"]
    @country       = hash["country"]
    @postal_code   = hash["postal_code"]
    
    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_details.rb, line 51
def set_errors(response)
  json = response.body
  hash = JSON.parse(json)
  @errors << hash["message"]
end