weather_by_dcq 0.1.0 → 0.1.1
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/Gemfile +1 -1
- data/Gemfile.lock +90 -0
- data/lib/weather_by_dcq.rb +0 -1
- data/lib/weather_by_dcq/forecast.rb +1 -1
- data/lib/weather_by_dcq/request.rb +7 -3
- data/lib/weather_by_dcq/version.rb +1 -1
- data/lib/weather_by_dcq/view.rb +2 -1
- data/weather_by_dcq.gemspec +2 -2
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5460ccb76abd9cfad36c324d07b1ce81c5e3c7b7e9edc684265eb6f8ab25cb8e
|
4
|
+
data.tar.gz: 62d88bda75e4baca4797a350501c49419edc7f8302bcc77446221f9fe019c581
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecaf1fa6309a65278126d9acf11b5d50cf16bda5b0187afcc3ee45f93bf9c3815b84d3315884f4bfa76963c57e5814376c64467fd7b37e38e821708b168a132d
|
7
|
+
data.tar.gz: 06d08cdc94753b6e7372a6f1c8e5e2f199ec7ad51a6b8679cdd32b006daa8ae65b5ed6cd42f2bd3aecab8692c5f99c5e684e1d5b7d41d48c212eb086f8d6318c
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
weather_by_dcq (0.1.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
coderay (1.1.2)
|
10
|
+
colorize (0.8.1)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
equatable (0.6.1)
|
13
|
+
faraday (0.17.1)
|
14
|
+
multipart-post (>= 1.2, < 3)
|
15
|
+
forecast_io (2.0.2)
|
16
|
+
faraday
|
17
|
+
hashie
|
18
|
+
multi_json
|
19
|
+
geocoder (1.5.2)
|
20
|
+
hashie (4.0.0)
|
21
|
+
httparty (0.17.3)
|
22
|
+
mime-types (~> 3.0)
|
23
|
+
multi_xml (>= 0.5.2)
|
24
|
+
json (2.3.0)
|
25
|
+
method_source (0.9.2)
|
26
|
+
mime-types (3.3)
|
27
|
+
mime-types-data (~> 3.2015)
|
28
|
+
mime-types-data (3.2019.1009)
|
29
|
+
multi_json (1.14.1)
|
30
|
+
multi_xml (0.6.0)
|
31
|
+
multipart-post (2.1.1)
|
32
|
+
necromancer (0.5.1)
|
33
|
+
pastel (0.7.3)
|
34
|
+
equatable (~> 0.6)
|
35
|
+
tty-color (~> 0.5)
|
36
|
+
pry (0.12.2)
|
37
|
+
coderay (~> 1.1.0)
|
38
|
+
method_source (~> 0.9.0)
|
39
|
+
rake (13.0.1)
|
40
|
+
rspec (3.9.0)
|
41
|
+
rspec-core (~> 3.9.0)
|
42
|
+
rspec-expectations (~> 3.9.0)
|
43
|
+
rspec-mocks (~> 3.9.0)
|
44
|
+
rspec-core (3.9.0)
|
45
|
+
rspec-support (~> 3.9.0)
|
46
|
+
rspec-expectations (3.9.0)
|
47
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
+
rspec-support (~> 3.9.0)
|
49
|
+
rspec-mocks (3.9.0)
|
50
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
+
rspec-support (~> 3.9.0)
|
52
|
+
rspec-support (3.9.0)
|
53
|
+
strings (0.1.8)
|
54
|
+
strings-ansi (~> 0.1)
|
55
|
+
unicode-display_width (~> 1.5)
|
56
|
+
unicode_utils (~> 1.4)
|
57
|
+
strings-ansi (0.2.0)
|
58
|
+
tty-color (0.5.0)
|
59
|
+
tty-cursor (0.7.0)
|
60
|
+
tty-screen (0.7.0)
|
61
|
+
tty-spinner (0.9.2)
|
62
|
+
tty-cursor (~> 0.7)
|
63
|
+
tty-table (0.11.0)
|
64
|
+
equatable (~> 0.6)
|
65
|
+
necromancer (~> 0.5)
|
66
|
+
pastel (~> 0.7.2)
|
67
|
+
strings (~> 0.1.5)
|
68
|
+
tty-screen (~> 0.7)
|
69
|
+
unicode-display_width (1.6.0)
|
70
|
+
unicode_utils (1.4.0)
|
71
|
+
|
72
|
+
PLATFORMS
|
73
|
+
ruby
|
74
|
+
|
75
|
+
DEPENDENCIES
|
76
|
+
bundler (~> 2.1.0)
|
77
|
+
colorize (~> 0.8.1)
|
78
|
+
forecast_io
|
79
|
+
geocoder
|
80
|
+
httparty
|
81
|
+
json
|
82
|
+
pry
|
83
|
+
rake
|
84
|
+
rspec (~> 3.9.0)
|
85
|
+
tty-spinner
|
86
|
+
tty-table
|
87
|
+
weather_by_dcq!
|
88
|
+
|
89
|
+
BUNDLED WITH
|
90
|
+
2.1.0
|
data/lib/weather_by_dcq.rb
CHANGED
@@ -40,7 +40,7 @@ class WeatherByDcq::Forecast
|
|
40
40
|
curr_table = TTY::Table.new ["\u{1F321} Temp.: #{@temperature}°C",
|
41
41
|
"\u{1F321} Heat Index: #{@apparentTemperature}°C"],
|
42
42
|
[["\u{1F4A6} Humidity: #{fetch_curr_data('humidity')}\u{0025}",
|
43
|
-
"
|
43
|
+
"🌀 Wind Speed: #{fetch_curr_data('windSpeed')}mph"]]
|
44
44
|
puts curr_table.render(:ascii, padding: [0, 2])
|
45
45
|
puts ''
|
46
46
|
end
|
@@ -17,8 +17,13 @@ class WeatherByDcq::Request
|
|
17
17
|
# Convert user entered location to geodetic coordinates
|
18
18
|
def self.coordinate_pts(location)
|
19
19
|
city = Geocoder.search(location)
|
20
|
-
|
21
|
-
|
20
|
+
if city[0].nil?
|
21
|
+
puts "Not Found"
|
22
|
+
return WeatherByDcq::View.new.menu
|
23
|
+
else
|
24
|
+
@lat = city[0].latitude
|
25
|
+
@lon = city[0].longitude
|
26
|
+
end
|
22
27
|
end
|
23
28
|
|
24
29
|
# fetch forecast hash from Dark Sky API
|
@@ -28,6 +33,5 @@ class WeatherByDcq::Request
|
|
28
33
|
c.api_key = '4aac124157c348289553a5e7fdc1899d'
|
29
34
|
c.default_params = { time: 600, exclude: 'minutely, hourly' }
|
30
35
|
end
|
31
|
-
@forecast = ForecastIO.forecast(@lat, @lon)
|
32
36
|
end
|
33
37
|
end
|
data/lib/weather_by_dcq/view.rb
CHANGED
@@ -9,7 +9,8 @@ class WeatherByDcq::View
|
|
9
9
|
def menu
|
10
10
|
puts ''
|
11
11
|
puts 'Please enter a city to retrieve a forecast (Format: City State):'
|
12
|
-
|
12
|
+
input_location = gets.strip
|
13
|
+
location = input_location.gsub(/[\W\d]/, '').upcase
|
13
14
|
|
14
15
|
puts "You entered: #{location}".colorize(:blue) + ' Is this correct (Y/N)?'
|
15
16
|
input_confirm = gets.strip.downcase
|
data/weather_by_dcq.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Doan Trung Quan"]
|
9
9
|
spec.email = ["doantrungquan97@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary = "
|
12
|
-
spec.description = "
|
11
|
+
spec.summary = "Weather API"
|
12
|
+
spec.description = "DarkSky API"
|
13
13
|
spec.homepage = "https://github.com/TOMOSIA-VIETNAM/weather_by_dcq"
|
14
14
|
spec.license = "MIT"
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weather_by_dcq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Doan Trung Quan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -150,7 +150,7 @@ dependencies:
|
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 0.11.0
|
153
|
-
description:
|
153
|
+
description: DarkSky API
|
154
154
|
email:
|
155
155
|
- doantrungquan97@gmail.com
|
156
156
|
executables: []
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- ".gitignore"
|
161
161
|
- CODE_OF_CONDUCT.md
|
162
162
|
- Gemfile
|
163
|
+
- Gemfile.lock
|
163
164
|
- LICENSE.txt
|
164
165
|
- README.md
|
165
166
|
- Rakefile
|
@@ -197,5 +198,5 @@ requirements: []
|
|
197
198
|
rubygems_version: 3.0.1
|
198
199
|
signing_key:
|
199
200
|
specification_version: 4
|
200
|
-
summary:
|
201
|
+
summary: Weather API
|
201
202
|
test_files: []
|