class EodFacade::Fundamentals
Public Class Methods
call(symbol)
click to toggle source
# File lib/eod_facade/fundamentals.rb, line 9 def call(symbol) unless Cache::RedisCache.get(redis_key(symbol)) response = make_request(url_path(symbol)) unless response.success? raise ArgumentError, "Error fetching fundamentals data for #{symbol}" end Cache::RedisCache.set( redis_key(symbol), response.parsed_response.to_json ) end Oj.load(Cache::RedisCache.get(redis_key(symbol))) end
Private Class Methods
redis_key(symbol)
click to toggle source
# File lib/eod_facade/fundamentals.rb, line 32 def redis_key(symbol) "#{symbol}_fundamentals" end
url_path(symbol)
click to toggle source
# File lib/eod_facade/fundamentals.rb, line 28 def url_path(symbol) "/fundamentals/#{symbol}" end