yahoo_finanza 0.3.0 → 0.3.1

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: af130ef3ca135486c91cca2ceb3ae2f431162480
4
- data.tar.gz: 36af5ea5d997e60d828b365c0b47488fd05f43b0
3
+ metadata.gz: 2881fe082006a66e1403108265a9a9994a79cc9d
4
+ data.tar.gz: 707e3e824ae079336f148cd91ed057506a06da93
5
5
  SHA512:
6
- metadata.gz: a651ce4227b9f057b29e83c1e47dd98a25db82888eab8ed5d3d8c6365b96cf98821e96fb49050493ab4e318cdf621ded8ade0b68f5d606dc0a0f837118b2b2cd
7
- data.tar.gz: 84e2e7c1cb5ac41bc22cf0e5723acf85edb3a49170411dcb60069ec42927eb5637b4ce8f771fa777e13e18dc14ddef90b7c76331bcefa6528f40dec3a7e809dd
6
+ metadata.gz: b5831afbf16dee8fb2af2d8377dc3d254da86a4de2f2a67dd8183e4e17a454eb2213f90a87c0a11c98c9683f8e935bdcc71f04777c4c511d21e18214ac03807d
7
+ data.tar.gz: 61d7669b8bf32a4acba40a0ba0a96681856e15f363736bb26295265aef54b6475ef8914d75f1ad8a1755b62cf478d64b04d51ace5f95d127d9abeaaf401ab933
@@ -37,8 +37,7 @@ module YahooFinanza
37
37
  end
38
38
 
39
39
  def active_symbols
40
- worker = YahooFinanza::Worker.new
41
- worker.process_page_2(worker.process_page_1)
40
+ YahooFinanza::Worker.new.get_active_stocks
42
41
  end
43
42
 
44
43
  def hash_to_query(hash)
@@ -1,4 +1,4 @@
1
1
  # Yahoo Finanza Version
2
2
  module YahooFinanza
3
- VERSION = '0.3.0'
3
+ VERSION = '0.3.1'
4
4
  end
@@ -9,27 +9,12 @@ module YahooFinanza
9
9
  @browser = Mechanize.new
10
10
  end
11
11
 
12
- def process_page_1
13
- symbols = []
14
- page_1 = @browser.get(YahooFinanza::Constants.active_nnm_url)
15
- page_1.links.each do |link|
16
- if link.text.split(" (").count > 1
17
- symbols.push(link.text.split(" (")[1].gsub(')', '').strip)
18
- end
19
- break unless symbols.count < 8
12
+ def get_active_stocks
13
+ nasdaq = @browser.get(YahooFinanza::Constants.active_nnm_url).search(".linkb")[0..24]
14
+ nyse = @browser.get(YahooFinanza::Constants.active_nyse_url).search(".linkb")[0..24]
15
+ (nasdaq + nyse).map do |stock|
16
+ stock.text.match(/\(.*?\)/)[0].gsub!("(", "").gsub!(")", "")
20
17
  end
21
- symbols
22
- end
23
-
24
- def process_page_2(symbols)
25
- page_2 = @browser.get(YahooFinanza::Constants.active_nyse_url)
26
- page_2.links.each do |link|
27
- if link.text.split(" (").count > 1
28
- symbols.push(link.text.split(" (")[1].gsub(')', '').strip)
29
- end
30
- break unless symbols.count < 16
31
- end
32
- symbols
33
18
  end
34
19
  end
35
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yahoo_finanza
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric D. Santos