Module: IEX::Endpoints::KeyStat

Included in:
Api::Client
Defined in:
lib/iex/endpoints/key_stat.rb

Instance Method Summary collapse

Instance Method Details

#key_stat(symbol, stat, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/iex/endpoints/key_stat.rb', line 4

def key_stat(symbol, stat, options = {})
  result = get("stock/#{symbol}/stats/#{stat}", { token: publishable_token }.merge(options))
  raise IEX::Errors::StatNotFoundError.new(stat, result) if result.is_a?(Hash)

  result
rescue Faraday::ResourceNotFound => e
  raise IEX::Errors::SymbolNotFoundError.new(symbol, e.response[:body])
end