ranNUM 1.1.6 → 1.2.0
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/ranNUM.rb +35 -1
- data/lib/textfiles/owmapi.txt +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3da4371c65cbe3cddcc06ad2009e6aacb7750a2f
|
|
4
|
+
data.tar.gz: 459be765f280e98bc181742d18a18ba9497d7d9f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cb7c088dcc671884ea6386b80bcb8b405da63c8d81f0268d17df7c5ee4f6241024d6e4f6a171d679312569c2b113d83edc453279ea858b573c07dd3cd3f52e45
|
|
7
|
+
data.tar.gz: f88b1961e5ba08b9599f17f96a867267193930fead5b70069b3da6d41efb722982ada58fe3b078dccddd1762a82e1bcd5ad107940eedc7da6fa290779b9a2b81
|
data/lib/ranNUM.rb
CHANGED
|
@@ -1,7 +1,37 @@
|
|
|
1
1
|
require 'json'
|
|
2
2
|
require 'net/http'
|
|
3
|
+
require 'optparse'
|
|
3
4
|
|
|
4
5
|
|
|
6
|
+
options = {}
|
|
7
|
+
OptionParser.new do |opts|
|
|
8
|
+
opts.banner = "\nRandom Number Generator.\n"
|
|
9
|
+
|
|
10
|
+
opts.on("-o", "--owmapi", "Adds Open Weather API for example -o 'API'") do |u|
|
|
11
|
+
options[:owmapistore] = u
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
opts.on("-h", "--help", "Displays help page") do
|
|
15
|
+
puts opts
|
|
16
|
+
exit
|
|
17
|
+
end
|
|
18
|
+
end.parse!
|
|
19
|
+
|
|
20
|
+
apis = []
|
|
21
|
+
|
|
22
|
+
ARGV.each do |api|
|
|
23
|
+
apis << api.dup
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
apis.each do |api|
|
|
27
|
+
api if options[:owmapistore]
|
|
28
|
+
|
|
29
|
+
#puts api
|
|
30
|
+
File.open('./textfiles/owmapi.txt', "w") do |f|
|
|
31
|
+
f.write api
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
5
35
|
class RAN
|
|
6
36
|
def self.sp500file
|
|
7
37
|
sp500_path = File.join( File.dirname(__FILE__), './textfiles/SP500.txt' )
|
|
@@ -15,6 +45,9 @@ class RAN
|
|
|
15
45
|
owm_path = File.join( File.dirname(__FILE__), './textfiles/owmid.txt' )
|
|
16
46
|
File.open( owm_path )
|
|
17
47
|
end
|
|
48
|
+
def self.owmapi
|
|
49
|
+
File.read('./textfiles/owmapi.txt')
|
|
50
|
+
end
|
|
18
51
|
#get stock data
|
|
19
52
|
def self.get_yql_data(ticker)
|
|
20
53
|
url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%3D%22#{ ticker }%22&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback="
|
|
@@ -41,7 +74,7 @@ class RAN
|
|
|
41
74
|
def self.w_TEMP
|
|
42
75
|
random_string_weather = rand(10000)
|
|
43
76
|
city = IO.readlines(RAN.owmfile)[random_string_weather]
|
|
44
|
-
api_owm =
|
|
77
|
+
api_owm = RAN.owmapi
|
|
45
78
|
output_weather = get_owm_data(city, api_owm)
|
|
46
79
|
output_weather["main"]["temp"]
|
|
47
80
|
end
|
|
@@ -59,6 +92,7 @@ class RAN
|
|
|
59
92
|
def self.num(rnNUM)
|
|
60
93
|
tensecond_RN = RAN.number
|
|
61
94
|
begin
|
|
95
|
+
#puts tensecond_RN
|
|
62
96
|
tensecond_RN /=10
|
|
63
97
|
end while tensecond_RN > rnNUM
|
|
64
98
|
tensecond_RN.abs
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4610a14e77ea7d2522ef38eed4bbee0c
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ranNUM
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Colby Taperts
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-07-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A simple random number generator using random temperature and stock prices
|
|
14
14
|
email: colbytaperts@gmail.com
|
|
@@ -19,6 +19,7 @@ files:
|
|
|
19
19
|
- lib/ranNUM.rb
|
|
20
20
|
- lib/textfiles/SP500.txt
|
|
21
21
|
- lib/textfiles/nnstocks.txt
|
|
22
|
+
- lib/textfiles/owmapi.txt
|
|
22
23
|
- lib/textfiles/owmid.txt
|
|
23
24
|
homepage: http://rubygems.org/gems/ranNUM
|
|
24
25
|
licenses:
|