ystock 0.4.1 → 0.4.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 33c02d05a9af3bbdcc221fc308a0441ee0c6de29
4
+ data.tar.gz: 747bea41a73333b0a7d93eaec448365caaa84e35
5
+ SHA512:
6
+ metadata.gz: d6ab6cbcf0e6572303c71f2d5befd084e2f32191fb09d060a80a9ef28757a74de8b97db740b869581b3b2f57c1cb18aca3fa945e27d9265b340a7db4c2256656
7
+ data.tar.gz: 6efbf15c16c946d43755c0046d99f71ddd632e8bed9a4c0995aa9fc2f5605fe320b9dbc1981c7a69e1b1096698c1aa268b968d577a5590e984edce1f1bbfeb39
data/README.markdown CHANGED
@@ -77,13 +77,12 @@ daylight_savings
77
77
 
78
78
  # Yahoo Usage
79
79
 
80
- ### Single Stock
80
+ ## Quote Usage
81
81
  ```ruby
82
- Ystock::Yahoo.get_quote("appl")
83
- ```
82
+ # Single Stock lookup {String}
83
+ Ystock::Yahoo.quote("appl")
84
84
 
85
- ### Multiple Stocks
86
- ```ruby
85
+ # Multiple Stock lookup {Array}
87
86
  Ystock::Yahoo.find(["aapl", "f", "goog"])
88
87
  ```
89
88
 
data/lib/ystock/yahoo.rb CHANGED
@@ -2,6 +2,17 @@ module Ystock
2
2
  class Yahoo
3
3
  @@service_uri = "http://download.finance.yahoo.com/d/quotes.csv"
4
4
 
5
+ def self.quote(stocks)
6
+ if stocks.is_a? Array
7
+ # => Many stocks
8
+ find(stocks)
9
+ else
10
+ # => Single Stock
11
+ get_quote(stocks)
12
+ end
13
+ end
14
+
15
+ private
5
16
  def self.find(args)
6
17
  stock_string = ""
7
18
  last_stock = args.last.to_s
@@ -19,11 +30,11 @@ module Ystock
19
30
  stock_data = Hash.new
20
31
  s = send_request(stock)
21
32
  a = s.chomp.split(",")
22
- return [{:symbol => stock,
33
+ return {:symbol => stock,
23
34
  :price => a[0],
24
35
  :change => a[1],
25
36
  :volume => a[2]
26
- }]
37
+ }
27
38
  end
28
39
 
29
40
  def self.format(results)
data/ystock.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ystock'
3
- s.version = "0.4.1"
3
+ s.version = "0.4.2"
4
4
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
5
5
  s.authors = ["Greg Winn"]
6
6
  s.date = %q{2012-06-09}
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.homepage = %q{http://github.com/gregwinn/ystock}
12
12
  s.require_paths = ["lib"]
13
13
  s.summary = %q{Grab stock information from Yahoo and Google Finance}
14
+ s.license = 'MIT'
14
15
 
15
16
  # => Other gem dependency
16
17
  s.add_dependency("httparty", "~> 0.10.1")
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ystock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
5
- prerelease:
4
+ version: 0.4.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Greg Winn
@@ -14,7 +13,6 @@ dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -41,27 +38,27 @@ files:
41
38
  - lib/ystock/google.rb
42
39
  - ystock.gemspec
43
40
  homepage: http://github.com/gregwinn/ystock
44
- licenses: []
41
+ licenses:
42
+ - MIT
43
+ metadata: {}
45
44
  post_install_message:
46
45
  rdoc_options: []
47
46
  require_paths:
48
47
  - lib
49
48
  required_ruby_version: !ruby/object:Gem::Requirement
50
- none: false
51
49
  requirements:
52
- - - ! '>='
50
+ - - '>='
53
51
  - !ruby/object:Gem::Version
54
52
  version: '0'
55
53
  required_rubygems_version: !ruby/object:Gem::Requirement
56
- none: false
57
54
  requirements:
58
- - - ! '>='
55
+ - - '>='
59
56
  - !ruby/object:Gem::Version
60
57
  version: '1.2'
61
58
  requirements: []
62
59
  rubyforge_project:
63
- rubygems_version: 1.8.25
60
+ rubygems_version: 2.0.3
64
61
  signing_key:
65
- specification_version: 3
62
+ specification_version: 4
66
63
  summary: Grab stock information from Yahoo and Google Finance
67
64
  test_files: []