yahoo_finanza 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d67caf5c36584b3c658875b6bb856f9f7d1c4490
4
- data.tar.gz: 10d3a88e837e36ccf45d01692a676a3e81b49e98
3
+ metadata.gz: 8eec01d7178fe8b9594e143eab83e8a30632f0ef
4
+ data.tar.gz: b230ec6053954c51cd45ef5b5bf1785a11bf7713
5
5
  SHA512:
6
- metadata.gz: 282d517bf9817efa74b1789e0daa10e8e0689517c1f46bab31cade3e348c7331f3765139c84d9049d5e60d2afe994f0460d7303dfc19a5e376a32594ab9805ad
7
- data.tar.gz: 36317f838b7d16913d6beff6069dc5ffdfc3690223a16055490d9038a7cc6a6bfc5e96a1b55a6b4a10bb823bdb651c25749788d8121ad87e0ee78ffda504f538
6
+ metadata.gz: 2d894214d272c9194992386463ff4bf3558e85ff8a6271d628a9ca2d813f015676eb1ea8c8f2eb9c43b1299b482666fc86b2ac77b1da7f39ec24f0c72fc0ebfd
7
+ data.tar.gz: 8e83bd13b441e671e189fd46a52f84e9c1fb68046dad4a9b52833d639c41cee9b6ffee74e4cc2ec72053a63259487224f1942d44a7afce99c062fb3b5083746a
@@ -28,6 +28,10 @@ module YahooFinanza
28
28
  end
29
29
  end
30
30
 
31
+ def search_endpoint(key)
32
+ "http://d.yimg.com/autoc.finance.yahoo.com/autoc?query=#{key}&callback=YAHOO.Finance.SymbolSuggest.ssCallback"
33
+ end
34
+
31
35
  def symbols_by_market(market)
32
36
  symbols = []
33
37
  return symbols if market.nil?
@@ -56,6 +60,13 @@ module YahooFinanza
56
60
  symbols_by_market('nyse').concat(symbols_by_market('nasdaq'))
57
61
  end
58
62
 
63
+ def search_symbols(key = '')
64
+ response = RestClient.get search_endpoint(key)
65
+ result = response.gsub(/YAHOO.Finance.SymbolSuggest.ssCallback\(|\)/, '')
66
+ json = JSON.parse(result)
67
+ json['ResultSet']['Result'].map{|quote| quote['symbol']}
68
+ end
69
+
59
70
  def active_symbols
60
71
  mecha_yahoo = Mechanize.new
61
72
  symbols = Array.new
@@ -1,4 +1,4 @@
1
1
  # Yahoo Finanza Version
2
2
  module YahooFinanza
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yahoo_finanza
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric D. Santos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-19 00:00:00.000000000 Z
11
+ date: 2015-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yql