ranNUM 1.0.3 → 1.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ranNUM.rb +12 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff14cb3aaa53b4586bf670058f618d66cc7dbea0
4
- data.tar.gz: eaac905d38f754e66ad473f82d0ce337c3c5d9c7
3
+ metadata.gz: 6dad3e9272627593d3481ccdc0f08c4706a4f6f9
4
+ data.tar.gz: c7646fc7b6a5f05528c780758b9b70495cec3505
5
5
  SHA512:
6
- metadata.gz: 576c41a6acabde9750b49e3df92f57c51e7b46d8f4d6c878e2480d561ddf0c59c76a11f57a007a5ae4db153bf115306ca46b2d265315e2173d1353175c107c42
7
- data.tar.gz: a74788a857bced22e49110ff76380de5a18f1a17d84572398afaf3d2c7b9c8485a47f8e93c40c75e5d599f40ed90e6834a74d7b253cf2c86205069f2096d250c
6
+ metadata.gz: 69e85c647b65fe1cde5e2deeb924edd0d2045b67fe1b5a837591526b832c75c1f400d049f5b42d5f2b532354074ece94293434239ffb68a8aaea88ce16d9a275
7
+ data.tar.gz: f1f32439bd416b83873b49a40eeb3e6d8410f92f1176ecfad5c46f10ecd5f2e0c1d1264ff1a17bb134061840e2c38b078dbab28ed0f74a06e99572e526781f9f
data/lib/ranNUM.rb CHANGED
@@ -1,9 +1,16 @@
1
1
  require 'json'
2
2
  require 'net/http'
3
- require 'textfiles/SP500.txt'
4
- require 'textfiles/owmid.txt'
3
+
5
4
 
6
5
  class RAN
6
+ def self.sp500file
7
+ sp500_path = File.join( File.dirname(__FILE__), './textfiles/SP500.txt' )
8
+ File.open( sp500_path )
9
+ end
10
+ def self.owmfile
11
+ owm_path = File.join( File.dirname(__FILE__), './textfiles/owmid.txt' )
12
+ File.open( owm_path )
13
+ end
7
14
  #get stock data
8
15
  def self.get_yql_data(ticker)
9
16
  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="
@@ -12,7 +19,7 @@ class RAN
12
19
  end
13
20
  def self.s_SYMBOL
14
21
  random_string_stocks = rand(500)
15
- IO.readlines("lib/textfiles/SP500.txt")[random_string_stocks]
22
+ IO.readlines(RAN.sp500file)[random_string_stocks]
16
23
  end
17
24
  #get weather data
18
25
  def self.get_owm_data(city_id, api_key)
@@ -24,7 +31,7 @@ class RAN
24
31
  end
25
32
  def self.w_TEMP
26
33
  random_string_weather = rand(10000)
27
- city = IO.readlines("lib/textfiles/owmid.txt")[random_string_weather]
34
+ city = IO.readlines(RAN.owmfile)[random_string_weather]
28
35
  api_owm = "4610a14e77ea7d2522ef38eed4bbee0c"
29
36
  output_weather = get_owm_data(city, api_owm)
30
37
  output_weather["main"]["temp"]
@@ -62,4 +69,4 @@ end
62
69
  #puts RAN.num(10)
63
70
 
64
71
  #prints a random number equal to or below the number in parentheses rounded
65
- #puts RAN.num(10).round
72
+ puts RAN.num(10).round
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ranNUM
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colby Taperts