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 +4 -4
- data/lib/GoogleFinance/Company.rb +18 -0
- data/lib/GoogleFinance/version.rb +1 -1
- metadata +2 -3
- data/GoogleFinance-0.1.2.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc82d26767cf80b170402b91485fe723c7d920a7
|
4
|
+
data.tar.gz: 11137b5bea33b5d8419026182ad69da73993366d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
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.
|
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-
|
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
|
data/GoogleFinance-0.1.2.gem
DELETED
Binary file
|