class EodFacade::BondFundamentals

Public Class Methods

call(symbol) click to toggle source
# File lib/eod_facade/bond_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 bond 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/bond_fundamentals.rb, line 32
def redis_key(symbol)
  "#{symbol}_bond_fundamentals"
end
url_path(symbol) click to toggle source
# File lib/eod_facade/bond_fundamentals.rb, line 28
def url_path(symbol)
  "/bond-fundamentals/#{symbol}"
end