ystock 0.4.8 → 0.4.10

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: 7cdaecc215cb1f6b26f3d44eb5c0b23a3f2bae38
4
- data.tar.gz: ed3f28525276055b6340f03f58c12d3765262b59
3
+ metadata.gz: a0a69cd8519073eda04ea13e8a68fe0b65a999cd
4
+ data.tar.gz: 291a060d31ae78ddb5c870e4fa7331113863d91a
5
5
  SHA512:
6
- metadata.gz: 847bb1caaf97f44fdfd8d59be9ef05612b868167bb8326d1c1a5135628f76502db1d77c0f04f7e7a4819443004c216b6950bbcf7c09bc82599e8791a4a713659
7
- data.tar.gz: d55b331e836d56365b64f42e60d62a5609c0f5b1bdeaf0c161ec30fb7842bf5bb47155c7f2a58eeb4fe66b37c8d027700f9cf3d8d7b5ad046b6443cb7c9c348c
6
+ metadata.gz: d760cf211546cf936cf8b4cc3d74c9545b542aea3dd4224101ef6bcae08bada92f855688284eb674108bf335c3048738ca3d2a2eca722650ed325830e153ffa2
7
+ data.tar.gz: f12e9bb72347bfd23b5e39a02bb266f9bd342de957403a75c16ceb2489bc5071d2fd12d747078ccbf137ff13e21c9cea1075c302bd865823d30525e86769caaf
data/README.markdown CHANGED
@@ -6,10 +6,10 @@ This gem provides you with the latest market data avalable, pulling from Yahoo F
6
6
  ## Install
7
7
  Add the following to your Gemfile
8
8
  ```ruby
9
- gem "ystock", "~> 0.4.8"
9
+ gem "ystock", "~> 0.4.9"
10
10
 
11
11
  # Or simply install it
12
- gem install ystock -v=0.4.8
12
+ gem install ystock -v=0.4.9
13
13
  ```
14
14
 
15
15
  ## Bundle
@@ -25,15 +25,15 @@ require 'ystock'
25
25
  ----
26
26
 
27
27
  # Yahoo Usage
28
- The examples below are how to use the Yahoo potion of the gem. All Yahoo requests are made with Ystock::Yahoo
28
+ The examples below are how to use the Yahoo potion of the gem. All Yahoo requests are made with Ystock.quote
29
29
 
30
30
  ## Quote Usage
31
31
  ```ruby
32
32
  # Single Stock lookup {String}
33
- Ystock::Yahoo.quote("aapl")
33
+ Ystock.quote("aapl")
34
34
 
35
35
  # Multiple Stock lookup {Array}
36
- Ystock::Yahoo.quote(["aapl", "f", "goog"])
36
+ Ystock.quote(["aapl", "f", "goog"])
37
37
  ```
38
38
 
39
39
  #### Available data
@@ -67,3 +67,5 @@ Ruby: 1.9.3
67
67
  Ruby: 2.0.0
68
68
 
69
69
  Ruby: 2.1.2
70
+
71
+ Ruby: 2.2.2
data/lib/ystock.rb CHANGED
@@ -9,7 +9,5 @@
9
9
  require 'cgi'
10
10
  require 'json'
11
11
  require 'net/http'
12
- require 'httparty'
13
12
 
14
- require 'ystock/yahoo'
15
- require 'ystock/google'
13
+ require 'ystock/ystock'
@@ -1,5 +1,5 @@
1
- module Ystock
2
- class Yahoo
1
+
2
+ class Ystock
3
3
  @@service_uri = "http://download.finance.yahoo.com/d/quotes.csv"
4
4
 
5
5
  def self.quote(stocks)
@@ -93,4 +93,4 @@ module Ystock
93
93
  end
94
94
 
95
95
  end
96
- end
96
+
data/ystock.gemspec CHANGED
@@ -1,17 +1,14 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ystock'
3
- s.version = "0.4.8"
3
+ s.version = "0.4.10"
4
4
  s.authors = ["Greg Winn"]
5
- s.date = %q{2014-11-24}
6
- s.description = %q{Grab stock information from Yahoo and Google Finance}
7
- s.email = %q{greg@winn.ws}
5
+ s.date = '2010-05-06'
6
+ s.description = %q{Grab stock information from Yahoo}
7
+ s.email = %q{winn.greg@gmail.com}
8
8
  s.extra_rdoc_files = ["README.markdown", "lib/ystock.rb"]
9
- s.files = ["README.markdown", "lib/ystock.rb","lib/ystock/yahoo.rb", "lib/ystock/google.rb", "ystock.gemspec"]
9
+ s.files = ["README.markdown", "lib/ystock.rb","lib/ystock/ystock.rb", "ystock.gemspec"]
10
10
  s.homepage = %q{http://github.com/gregwinn/ystock}
11
11
  s.require_paths = ["lib"]
12
- s.summary = %q{Grab stock information from Yahoo and Google Finance}
12
+ s.summary = %q{Grab stock information from Yahoo}
13
13
  s.license = 'MIT'
14
-
15
- # => Other gem dependency
16
- s.add_dependency("httparty", "~> 0.10.1")
17
14
  end
metadata CHANGED
@@ -1,31 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ystock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Winn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-24 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: httparty
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: 0.10.1
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ~>
25
- - !ruby/object:Gem::Version
26
- version: 0.10.1
27
- description: Grab stock information from Yahoo and Google Finance
28
- email: greg@winn.ws
11
+ date: 2010-05-06 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Grab stock information from Yahoo
14
+ email: winn.greg@gmail.com
29
15
  executables: []
30
16
  extensions: []
31
17
  extra_rdoc_files:
@@ -34,8 +20,7 @@ extra_rdoc_files:
34
20
  files:
35
21
  - README.markdown
36
22
  - lib/ystock.rb
37
- - lib/ystock/google.rb
38
- - lib/ystock/yahoo.rb
23
+ - lib/ystock/ystock.rb
39
24
  - ystock.gemspec
40
25
  homepage: http://github.com/gregwinn/ystock
41
26
  licenses:
@@ -47,18 +32,18 @@ require_paths:
47
32
  - lib
48
33
  required_ruby_version: !ruby/object:Gem::Requirement
49
34
  requirements:
50
- - - '>='
35
+ - - ">="
51
36
  - !ruby/object:Gem::Version
52
37
  version: '0'
53
38
  required_rubygems_version: !ruby/object:Gem::Requirement
54
39
  requirements:
55
- - - '>='
40
+ - - ">="
56
41
  - !ruby/object:Gem::Version
57
42
  version: '0'
58
43
  requirements: []
59
44
  rubyforge_project:
60
- rubygems_version: 2.2.0
45
+ rubygems_version: 2.4.5
61
46
  signing_key:
62
47
  specification_version: 4
63
- summary: Grab stock information from Yahoo and Google Finance
48
+ summary: Grab stock information from Yahoo
64
49
  test_files: []
data/lib/ystock/google.rb DELETED
@@ -1,70 +0,0 @@
1
- # This code is in the repo at this point for historical use
2
- # I will replace it with something new or move it to a historical
3
- # branch at some point.
4
- #
5
- # Google's Finance API shutdown some time ago.
6
- # No Ystock::Google methods will function.
7
- module Ystock
8
- class Google
9
- @@google_service = "http://www.google.com/ig/api"
10
-
11
- def self.quote(args)
12
- if args.is_a? Array
13
- many_stocks(args)
14
- else
15
- single_stock(args)
16
- end
17
- end
18
-
19
- def self.many_stocks(stocks)
20
- stock_string = ""
21
- stocks.each do |stock|
22
- if stocks.first == stock
23
- stock_string += "?stock=" + stock
24
- else
25
- stock_string += "&stock=" + stock
26
- end
27
- end
28
- format(send_request(stock_string), true)
29
- end
30
-
31
- def self.single_stock(stock)
32
- stock = "?stock=" + stock
33
- format(send_request(stock), false)
34
- end
35
-
36
- def self.format(results, is_many)
37
- output = Array.new
38
-
39
- results.each do |item|
40
-
41
- if is_many
42
- # => Multiple Stocks
43
- item[1]["finance"].each do |stock|
44
- stock_data = Hash.new
45
- stock.each do |key, val|
46
- stock_data[:"#{key}"] = (!val["data"].nil?) ? val["data"] : val
47
- end
48
- output << [stock_data]
49
- end
50
-
51
- else
52
- # => Single Stock
53
- stock_data = Hash.new
54
- item[1]["finance"].each do |key, val|
55
- stock_data[:"#{key}"] = (!val["data"].nil?) ? val["data"] : val
56
- end
57
- output = stock_data
58
- end
59
- end
60
-
61
- return output
62
-
63
- end
64
-
65
- def self.send_request(args)
66
- url = @@google_service + args
67
- return HTTParty.get(url)
68
- end
69
- end
70
- end