Commit 5c9e7ae

mo khan <mo@mokhan.ca>
2014-03-22 03:52:19
extract constant for target API URL.
1 parent 1276c0b
Changed files (1)
lib
lib/service/stock_service.rb
@@ -1,12 +1,11 @@
 class StockService
+  API_URL = 'http://download.finance.yahoo.com/d/quotes.csv'
   def initialize(http_gateway = HttpGateway.new)
     @http_gateway = http_gateway
   end
 
-  #http://download.finance.yahoo.com/d/quotes.csv?s=%40%5EDJI,GOOG&f=nsl1op&e=.csv
   def fetch(symbol)
-    #map_from(@http_gateway.get('http://download.finance.yahoo.com/d/quotes.csv', {s: 'GOOG', f: 'nsl1', e: '.csv'}))
-    map_from(@http_gateway.get('http://download.finance.yahoo.com/d/quotes.csv', {s: symbol, f: 'nsl1', e: '.csv'}))
+    map_from(@http_gateway.get(API_URL, {s: symbol, f: 'nsl1', e: '.csv'}))
   end
 
   private