GoogleFinance 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b30307bb6718c9806a5fc4236d0e5e668f9b5bf3
4
- data.tar.gz: b8875f943c3145c7396d661e05c8e2d28d394f2a
3
+ metadata.gz: cc82d26767cf80b170402b91485fe723c7d920a7
4
+ data.tar.gz: 11137b5bea33b5d8419026182ad69da73993366d
5
5
  SHA512:
6
- metadata.gz: f7f76e676302cba8e7e63c929217b0f63de1539194c302a95c0612cf8d33bd412d05c9278d3390dd8897653225c420b63dbb2756f7c6e75fa33669895bf3ba8b
7
- data.tar.gz: ca84f039b1d971532bb8a9240c5f91f6f4640d02165cad3316c7f3993f6affbca8a19ce40734f8d11d043ed9d4754b607f55fc5e7450f759fb4ca6f55e69a26e
6
+ metadata.gz: d069e2597685a472d537453dfce202615c40cbbd85da6a037a222a2103cbd24b1c8b51423aa61179e8475c39c3e562a6e6ad0e35ce995fbd4a685e9e9052c932
7
+ data.tar.gz: 92357fe4bda4833625ae22b2fa209f2d42b917b8b932347115671cc6fe6188bb8c0cd7c4487029d6fa6296fbd48e5aac133729fc2204cb53f7f65ff32a8cb055
@@ -48,6 +48,24 @@ module GoogleFinance
48
48
 
49
49
  end # get_historical_prices
50
50
 
51
+ #
52
+ # get the outstanding share count
53
+ def shares
54
+ return @shares unless @shares.nil?
55
+
56
+ name_url = "https://google.com/finance?q=" + @ticker
57
+ page = Nokogiri::HTML(open(name_url))
58
+ share = page.xpath("//table[@class='snap-data']/tr[3]/td")[3].inner_html.gsub(/\n|,|-/, "")
59
+
60
+ # if the thing says 'M' then it's million, if it's 'B' then billions, obviously
61
+ if share.match(/M$/) then
62
+ @shares = share.gsub("M", "").to_f
63
+ elsif share.match(/B$/) then
64
+ @shares = share.gsub("B", "").to_f * 1000
65
+ end
66
+ @shares
67
+ end
68
+
51
69
 
52
70
  end # class Company
53
71
 
@@ -1,3 +1,3 @@
1
1
  module GoogleFinance
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: GoogleFinance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Brunet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-18 00:00:00.000000000 Z
11
+ date: 2016-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -77,7 +77,6 @@ files:
77
77
  - ".gitignore"
78
78
  - ".rspec"
79
79
  - Gemfile
80
- - GoogleFinance-0.1.2.gem
81
80
  - GoogleFinance.gemspec
82
81
  - LICENSE.txt
83
82
  - README.md
Binary file