tyrauber / stock_quote

A ruby gem that retrieves stock quotes from IEX
MIT License
211 stars 55 forks source link

added symbol lookup by company name #37

Closed KharkivReM closed 7 years ago

KharkivReM commented 7 years ago

Added lookup by company name and filtering by exchange

pry(main)> StockQuote::Symbol.symbol_lookup('Apple', 'NAS').map(&:symbol)
=> ["AAPL", "APPIX", "AGPLX"]

StockQuote::Symbol.symbol_lookup('Apple Inc', 'NAS')
=> [#<StockQuote::Symbol:0x007ffec0229fb8 @exch="NAS", @exch_disp="NASDAQ", @name="Apple Inc.", @symbol="AAPL", @type="S", @type_disp="Equity">]
tyrauber commented 7 years ago

@KharkivReM Very nice. Thank you. I got a couple comment I'll add inline.

tyrauber commented 7 years ago

This is great, thanks!

I merged it in, but am now wondering, is there any reason why we don't just name the method 'lookup' instead of 'symbol_lookup' since it is a class method on Symbol. Symbol.symbol_lookup seems redundant.

Are you opposed to me making that change?

KharkivReM commented 7 years ago

no, I don't have any problem with changing it to Symbol.lookup. Initially, I put this method to class 'Stock' and named it 'symbol_lookup', but after some refactoring and moving it to a separate class I simply forgot to change the method name.

tyrauber commented 7 years ago

Done. Version bumped to 1.3.0. Thank you very much for the contribution.

KharkivReM commented 7 years ago

Great! Thank you for making such a good gem!