Class: Vaultoro::BasicAPI::LatestPrice

Inherits:
Vaultoro::Base show all
Defined in:
lib/vaultoro/basic_api/latest_price.rb

Instance Method Summary collapse

Methods inherited from Vaultoro::Base

#inspect

Instance Method Details

#fetchObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vaultoro/basic_api/latest_price.rb', line 6

def fetch
  @errors.clear

  response = Client.get('/latest', {})
  code = response.code rescue ""

  case code
  when '200'
    @status = 'SUCCESS'
    @gold_price = response.body.to_f

    return true
  else
    set_errors(response)
    return false
  end
end