weather_by_dcq 0.1.1 → 0.1.2
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 +6 -4
- data/README.md +5 -4
- data/Rakefile +5 -3
- data/bin/console +4 -3
- data/bin/weather-by-dcq.rb +1 -0
- data/lib/weather_by_dcq.rb +1 -1
- data/lib/weather_by_dcq/forecast.rb +5 -9
- data/lib/weather_by_dcq/request.rb +1 -0
- data/lib/weather_by_dcq/version.rb +1 -1
- data/weather_by_dcq.gemspec +16 -16
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9387f95eb6353180e468a2ab994ea909ae381b2c5c1cb1ac9451c29b4dda5d33
|
4
|
+
data.tar.gz: 156021ab8e68e40337cfaffad9338fc65e966a336b884fa1df1082e87100c502
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf5b4a3d83e5bbe5c446c3d067bbbc3c769250714679c728c00f480ff2319f5877ba067abe93c74b6c3b048730f4bcab02932c90ecf584e9d93826a6365312a2
|
7
|
+
data.tar.gz: bff3334406455c1a96f61feb00fd84cd22461b68d9568f3099b7a538b4aaa7e41b406be5172d260ea0c5d1206c4480d3e769ee7916577ccda5cd36b4447f4d4b
|
data/Gemfile
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
# Specify your gem's dependencies in weather_by_dcq.gemspec
|
4
6
|
gemspec
|
5
7
|
|
6
|
-
gem
|
8
|
+
gem 'forecast_io'
|
9
|
+
gem 'geocoder'
|
7
10
|
gem 'httparty'
|
8
11
|
gem 'json'
|
9
12
|
gem 'pry'
|
13
|
+
gem 'rake'
|
10
14
|
gem 'tty-spinner'
|
11
15
|
gem 'tty-table'
|
12
|
-
gem 'forecast_io'
|
13
|
-
gem 'geocoder'
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/weather_by_dcq`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
4
|
|
5
|
-
|
5
|
+
Get DarkSky API
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -22,7 +22,8 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
WeatherByDcq::View.new.menu
|
26
|
+
<img src="https://i.imgur.com/d2eswbf.jpg" />
|
26
27
|
|
27
28
|
## Development
|
28
29
|
|
@@ -32,7 +33,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
33
|
|
33
34
|
## Contributing
|
34
35
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/TOMOSIA-VIETNAM/weather_by_dcq. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/TOMOSIA-VIETNAM/weather_by_dcq/blob/master/CODE_OF_CONDUCT.md).
|
36
37
|
|
37
38
|
|
38
39
|
## License
|
@@ -41,4 +42,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
41
42
|
|
42
43
|
## Code of Conduct
|
43
44
|
|
44
|
-
Everyone interacting in the WeatherByDcq project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
45
|
+
Everyone interacting in the WeatherByDcq project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/TOMOSIA-VIETNAM/weather_by_dcq/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'weather_by_dcq'
|
5
6
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +11,5 @@ require "weather_by_dcq"
|
|
10
11
|
# require "pry"
|
11
12
|
# Pry.start
|
12
13
|
|
13
|
-
require
|
14
|
+
require 'irb'
|
14
15
|
IRB.start(__FILE__)
|
data/bin/weather-by-dcq.rb
CHANGED
data/lib/weather_by_dcq.rb
CHANGED
@@ -28,15 +28,14 @@ class WeatherByDcq::Forecast
|
|
28
28
|
spinner.success
|
29
29
|
|
30
30
|
@forecast = WeatherByDcq::Request.fetch(location)
|
31
|
-
puts
|
32
|
-
puts
|
31
|
+
puts ''
|
32
|
+
puts '🌐 ' + @forecast['timezone']
|
33
33
|
|
34
34
|
temperature = fetch_curr_data('temperature').to_i
|
35
35
|
@temperature = ((temperature - 32) / 1.8).round(2)
|
36
36
|
apparentTemperature = fetch_curr_data('apparentTemperature').to_i
|
37
37
|
@apparentTemperature = ((apparentTemperature - 32) / 1.8).round(2)
|
38
38
|
|
39
|
-
|
40
39
|
curr_table = TTY::Table.new ["\u{1F321} Temp.: #{@temperature}°C",
|
41
40
|
"\u{1F321} Heat Index: #{@apparentTemperature}°C"],
|
42
41
|
[["\u{1F4A6} Humidity: #{fetch_curr_data('humidity')}\u{0025}",
|
@@ -82,14 +81,14 @@ class WeatherByDcq::Forecast
|
|
82
81
|
t << ["🌀 Wind: #{fetch_data(num, 'windSpeed').to_i}mph",
|
83
82
|
"🌦 Precip Prob.: #{(fetch_data(num, 'precipProbability') * 100).to_i}\u{0025}",
|
84
83
|
"🌧 Precip.: #{fetch_data(num, 'precipType').to_s.capitalize}"]
|
85
|
-
t << ["💧 Humidity: #{(fetch_data(num, 'humidity')*100).to_i}\u{0025}",
|
84
|
+
t << ["💧 Humidity: #{(fetch_data(num, 'humidity') * 100).to_i}\u{0025}",
|
86
85
|
"🌇 Sunrise: #{fetch_sun_data(num, 'sunriseTime')}AM", "🌆 Sunset: #{fetch_sun_data(num, 'sunsetTime')}PM"]
|
87
86
|
end
|
88
87
|
|
89
88
|
puts " #{fetch_data(num, 'summary')}".colorize(:red)
|
90
|
-
puts
|
89
|
+
puts ''
|
91
90
|
@icon = fetch_data(num, 'icon')
|
92
|
-
if @icon.eql?'rain'
|
91
|
+
if @icon.eql? 'rain'
|
93
92
|
puts " \u{2614}" + " #{@icon}".colorize(:yellow)
|
94
93
|
elsif @icon.eql?'clear-day'
|
95
94
|
puts " \u{1F324}" + " #{@icon}".colorize(:yellow)
|
@@ -103,8 +102,5 @@ class WeatherByDcq::Forecast
|
|
103
102
|
renderer.border.separator = :each_row
|
104
103
|
renderer.border.style = :cyan
|
105
104
|
}
|
106
|
-
|
107
|
-
|
108
|
-
|
109
105
|
end
|
110
106
|
end
|
data/weather_by_dcq.gemspec
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require_relative 'lib/weather_by_dcq/version'
|
4
6
|
|
5
7
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
8
|
+
spec.name = 'weather_by_dcq'
|
7
9
|
spec.version = WeatherByDcq::VERSION
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
10
|
-
|
11
|
-
spec.summary = "Weather API"
|
12
|
-
spec.description = "DarkSky API"
|
13
|
-
spec.homepage = "https://github.com/TOMOSIA-VIETNAM/weather_by_dcq"
|
14
|
-
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
16
|
-
|
10
|
+
spec.authors = ['Doan Trung Quan']
|
11
|
+
spec.email = ['doantrungquan97@gmail.com']
|
17
12
|
|
13
|
+
spec.summary = 'Weather API'
|
14
|
+
spec.description = 'DarkSky API'
|
15
|
+
spec.homepage = 'https://github.com/TOMOSIA-VIETNAM/weather_by_dcq'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
18
18
|
|
19
|
-
spec.metadata[
|
20
|
-
spec.metadata[
|
21
|
-
spec.metadata[
|
19
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
+
spec.metadata['source_code_uri'] = 'https://github.com/TOMOSIA-VIETNAM/weather_by_dcq.'
|
21
|
+
spec.metadata['changelog_uri'] = 'https://github.com/TOMOSIA-VIETNAM/weather_by_dcq.'
|
22
22
|
|
23
23
|
# Specify which files should be added to the gem when it is released.
|
24
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
-
spec.files
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
26
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
27
|
end
|
28
|
-
spec.bindir =
|
28
|
+
spec.bindir = 'exe'
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
-
spec.require_paths = [
|
30
|
+
spec.require_paths = ['lib']
|
31
31
|
|
32
32
|
spec.add_development_dependency 'bundler', '~> 2.1.0'
|
33
33
|
spec.add_development_dependency 'colorize', '~>0.8.1'
|