ystock 0.4.10 → 0.4.11

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: a0a69cd8519073eda04ea13e8a68fe0b65a999cd
4
- data.tar.gz: 291a060d31ae78ddb5c870e4fa7331113863d91a
3
+ metadata.gz: 714d1b3574d35826a84b09f3427b76b65548e98d
4
+ data.tar.gz: bd38ea7454ec3c31c7bca4f44e177a121f700b0f
5
5
  SHA512:
6
- metadata.gz: d760cf211546cf936cf8b4cc3d74c9545b542aea3dd4224101ef6bcae08bada92f855688284eb674108bf335c3048738ca3d2a2eca722650ed325830e153ffa2
7
- data.tar.gz: f12e9bb72347bfd23b5e39a02bb266f9bd342de957403a75c16ceb2489bc5071d2fd12d747078ccbf137ff13e21c9cea1075c302bd865823d30525e86769caaf
6
+ metadata.gz: af4c6bad050c6b2deed0e70d43589f300b18083f16833e46823646d293e967c7c87a05d0af5a353d6a63e522f9d84359cfd0f8ba3e5acd6b337f738ba0e36154
7
+ data.tar.gz: 063f50b0a3ed2d12a49a50bc87006de5b36225f4c54bb0e80bbdfce55203bbb74b25314d12014e43750eb9200c5a1471f74bf28a1159dbe06e57dcd5060a532b
@@ -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.9"
9
+ gem "ystock", "~> 0.4.11"
10
10
 
11
11
  # Or simply install it
12
- gem install ystock -v=0.4.9
12
+ gem install ystock -v=0.4.11
13
13
  ```
14
14
 
15
15
  ## Bundle
@@ -29,10 +29,10 @@ The examples below are how to use the Yahoo potion of the gem. All Yahoo request
29
29
 
30
30
  ## Quote Usage
31
31
  ```ruby
32
- # Single Stock lookup {String}
32
+ # Single Stock lookup 'String'
33
33
  Ystock.quote("aapl")
34
34
 
35
- # Multiple Stock lookup {Array}
35
+ # Multiple Stock lookup [Array]
36
36
  Ystock.quote(["aapl", "f", "goog"])
37
37
  ```
38
38
 
@@ -57,7 +57,7 @@ exchange
57
57
 
58
58
  ----
59
59
 
60
- ### Tested with
60
+ ### Tested Ruby Versions
61
61
  This gem was tested with:
62
62
 
63
63
  Ruby: ~~1.9.2~~ -> No longer supported.
@@ -69,3 +69,10 @@ Ruby: 2.0.0
69
69
  Ruby: 2.1.2
70
70
 
71
71
  Ruby: 2.2.2
72
+
73
+
74
+ ### Run RSpec tests
75
+ ```
76
+ rspec spec/yahoo_spec.rb
77
+ ```
78
+
@@ -5,54 +5,21 @@
5
5
  def self.quote(stocks)
6
6
  if stocks.is_a? Array
7
7
  # => Many stocks
8
- find(stocks)
8
+ format(send_request(stocks.join(",")))
9
9
  else
10
10
  # => Single Stock
11
- get_quote(stocks)
11
+ format(send_request(stocks)).first
12
12
  end
13
13
  end
14
14
 
15
15
  private
16
- def self.find(args)
17
- stock_string = ""
18
- last_stock = args.last.to_s
19
- args.each do |stock|
20
- if last_stock == stock.to_sym
21
- stock_string += stock.to_s
22
- else
23
- stock_string += stock.to_s + ","
24
- end
25
- end
26
- format(send_request(stock_string))
27
- end
28
-
29
- def self.get_quote(stock)
30
- stock_data = Hash.new
31
- s = send_request(stock)
32
- a = s.chomp.split(",")
33
- return {:symbol => stock,
34
- :price => a[0],
35
- :change => a[1],
36
- :volume => a[2],
37
- :change_percent => a[4].gsub("\r\n", "").gsub('"', ''),
38
- :open => a[5],
39
- :day_high => a[6],
40
- :day_low => a[7],
41
- :previous_close => a[8],
42
- :after_hours_change => a[9].gsub("\r\n", "").gsub('"', ''),
43
- :ma50 => a[10],
44
- :ma200 => a[11],
45
- :week52_range => a[12].gsub("\r\n", "").gsub('"', ''),
46
- :pe_ratio => a[13],
47
- :exchange => a[14]
48
- }
49
- end
50
-
51
16
  def self.format(results)
52
17
  output = Array.new
53
18
  results.each_line("\n") do |row|
54
19
  stockdata = row.split(",")
55
20
  if !stockdata.nil?
21
+
22
+ # => Check to see if the Symbol is nil
56
23
  if !stockdata[3].nil?
57
24
  stockdata[3] = stockdata[3].gsub("\r\n", "").gsub('"', '')
58
25
 
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ystock'
3
- s.version = "0.4.10"
3
+ s.version = "0.4.11"
4
4
  s.authors = ["Greg Winn"]
5
- s.date = '2010-05-06'
5
+ s.date = '2015-07-28'
6
6
  s.description = %q{Grab stock information from Yahoo}
7
7
  s.email = %q{winn.greg@gmail.com}
8
8
  s.extra_rdoc_files = ["README.markdown", "lib/ystock.rb"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ystock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.10
4
+ version: 0.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Winn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2010-05-06 00:00:00.000000000 Z
11
+ date: 2015-07-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Grab stock information from Yahoo
14
14
  email: winn.greg@gmail.com
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  version: '0'
43
43
  requirements: []
44
44
  rubyforge_project:
45
- rubygems_version: 2.4.5
45
+ rubygems_version: 2.2.2
46
46
  signing_key:
47
47
  specification_version: 4
48
48
  summary: Grab stock information from Yahoo