Module: IEX::Api::Quote
- Defined in:
- lib/iex/api/quote.rb
Class Method Summary collapse
Class Method Details
.connection(symbol) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/iex/api/quote.rb', line 12 def self.connection(symbol) Faraday.new( url: "https://api.iextrading.com/1.0/stock/#{symbol}/quote", request: { params_encoder: Faraday::FlatParamsEncoder } ) do |c| c.use ::FaradayMiddleware::ParseJson c.use Faraday::Response::RaiseError c.use Faraday::Adapter::NetHttp end end |
.get(params) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/iex/api/quote.rb', line 4 def self.get(params) params = params.dup symbol = params.delete(:q) connection(symbol).get do |c| c.params.merge!(params) end.body end |