weatherfetch 0.0.1 → 0.0.3

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
  SHA256:
3
- metadata.gz: cf006c75b7a296fc87cb804c786192af26df5a948df903db992e7948b6dff89f
4
- data.tar.gz: 36a5ae3ed3adb669ecb8f58000684e167f033dd38735d6a3683eb7ca04556488
3
+ metadata.gz: adf062366579620ac82e2d599cd7f162be4b134d7fa011185d52fc0a548b0002
4
+ data.tar.gz: dacd56d05c3c1e17f07dde431dad3c1f95bf83361e795c8113e998f91cad7aa3
5
5
  SHA512:
6
- metadata.gz: 07d2d07074a94a1c1d6fd9704164de287770797085e4b5657e82dcf9cc9698efa66378799bf53c3fd9f02c10a558112bba152b6d79a3d4a990114189cd9d93fa
7
- data.tar.gz: bbed18f2e4610d2e46a3963468ea76d70f68be28f83cb06d6677ebbe5cf1534a2279015c86530275d14f2c5a2808ab2889b0084e8b90878902c15e2cb9f5967e
6
+ metadata.gz: 48e0fbf3dc2ef9e3b6c41e25981c915ad6758a0e4e9c99b70ca17e9a409adbe33ce8514fdef7739121733b63965b718ef2d03517f86bbaeb0d37da833f54b49d
7
+ data.tar.gz: 73101963a77f63414fd5934030a5a6d5af47b38f8f86083a7c48f5b174db3f8c53150fa0181f761f3981f4ba9a1082a948a30c17bff84ccf2ac9fc8e4bc18acd
@@ -10,16 +10,9 @@ module WeatherFetch
10
10
  true
11
11
  end
12
12
 
13
- desc 'current', 'Get current weather for a given city'
14
- def current(city)
15
- options = { query: { q: city, appid: 'c8d7f5fd25b8914cc543ed45e6a40bba' } }
16
- r = HTTParty.get('http://api.openweathermap.org/data/2.5/weather', options)
17
- puts r
18
- end
19
-
20
- desc 'hourly', 'Get hourly weather for a given city'
21
- def hourly(city)
22
- response = fetch_city_data(city, 'hourly')
13
+ desc 'hourly', 'Get hourly weather for a given location'
14
+ def hourly(location)
15
+ response = fetch_location_data(location, 'hourly')
23
16
 
24
17
  rows = response['hourly'].map do |hour|
25
18
  [
@@ -34,19 +27,21 @@ module WeatherFetch
34
27
  table = Terminal::Table.new(
35
28
  headings: create_headings(['Hour', 'Actual', 'Feels Like', 'Conditions', 'Humidity']),
36
29
  rows: rows,
37
- title: Rainbow(city.capitalize).cornflower
30
+ title: "🌧 #{Rainbow(location.capitalize).cornflower} 🌞"
38
31
  )
39
32
 
40
33
  puts table
41
34
  end
42
35
 
43
- desc 'daily', 'Get daily weather for a given city'
44
- def daily(city)
45
- response = fetch_city_data(city, 'daily')
36
+ desc 'daily', 'Get daily weather for a given location'
37
+ def daily(location)
38
+ response = fetch_location_data(location, 'daily')
46
39
 
47
40
  rows = response['daily'].map do |day|
48
41
  [
49
42
  Rainbow(Time.at(day['dt']).strftime('%m/%d')).darkolivegreen,
43
+ Rainbow("#{day['temp']['min']}°F").darkolivegreen,
44
+ Rainbow("#{day['temp']['max']}°F").darkolivegreen,
50
45
  Rainbow("#{day['temp']['morn']}°F").darkolivegreen,
51
46
  Rainbow("#{day['temp']['day']}°F").darkolivegreen,
52
47
  Rainbow("#{day['temp']['eve']}°F").darkolivegreen,
@@ -57,9 +52,9 @@ module WeatherFetch
57
52
  end
58
53
 
59
54
  table = Terminal::Table.new do |t|
60
- t.headings = create_headings(['Date', 'Morning', 'Afternoon', 'Evening', 'Night', 'Conditions', 'Humidity'])
55
+ t.headings = create_headings(['Date', 'Min', 'Max', 'Morning', 'Afternoon', 'Evening', 'Night', 'Conditions', 'Humidity'])
61
56
  t.rows = rows
62
- t.title = Rainbow(city.capitalize).cornflower
57
+ t.title = "🌧 #{Rainbow(location.capitalize).cornflower} 🌞"
63
58
  t.style = { all_separators: :true }
64
59
  end
65
60
 
@@ -71,8 +66,8 @@ module WeatherFetch
71
66
  headings.map { |h| Rainbow(h).red }
72
67
  end
73
68
 
74
- def fetch_city_data(city, type)
75
- latitude, longitude = Geocoder.search(city).first.coordinates
69
+ def fetch_location_data(location, type)
70
+ latitude, longitude = Geocoder.search(location).first.coordinates
76
71
 
77
72
  exclusions = ['hourly', 'minutely', 'current', 'daily'].reject do |ex|
78
73
  ex == type
@@ -1,3 +1,3 @@
1
1
  module WeatherFetch
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weatherfetch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Andrews
@@ -107,7 +107,7 @@ files:
107
107
  - lib/weatherfetch.rb
108
108
  - lib/weatherfetch/cli.rb
109
109
  - lib/weatherfetch/version.rb
110
- homepage:
110
+ homepage: https://github.com/DylanAndrews/weatherfetch
111
111
  licenses:
112
112
  - MIT
113
113
  metadata: {}
@@ -129,5 +129,5 @@ requirements: []
129
129
  rubygems_version: 3.1.2
130
130
  signing_key:
131
131
  specification_version: 4
132
- summary: Gem for fetching weather data
132
+ summary: CLI tool for fetching weather data
133
133
  test_files: []