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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5460ccb76abd9cfad36c324d07b1ce81c5e3c7b7e9edc684265eb6f8ab25cb8e
4
- data.tar.gz: 62d88bda75e4baca4797a350501c49419edc7f8302bcc77446221f9fe019c581
3
+ metadata.gz: 9387f95eb6353180e468a2ab994ea909ae381b2c5c1cb1ac9451c29b4dda5d33
4
+ data.tar.gz: 156021ab8e68e40337cfaffad9338fc65e966a336b884fa1df1082e87100c502
5
5
  SHA512:
6
- metadata.gz: ecaf1fa6309a65278126d9acf11b5d50cf16bda5b0187afcc3ee45f93bf9c3815b84d3315884f4bfa76963c57e5814376c64467fd7b37e38e821708b168a132d
7
- data.tar.gz: 06d08cdc94753b6e7372a6f1c8e5e2f199ec7ad51a6b8679cdd32b006daa8ae65b5ed6cd42f2bd3aecab8692c5f99c5e684e1d5b7d41d48c212eb086f8d6318c
6
+ metadata.gz: cf5b4a3d83e5bbe5c446c3d067bbbc3c769250714679c728c00f480ff2319f5877ba067abe93c74b6c3b048730f4bcab02932c90ecf584e9d93826a6365312a2
7
+ data.tar.gz: bff3334406455c1a96f61feb00fd84cd22461b68d9568f3099b7a538b4aaa7e41b406be5172d260ea0c5d1206c4480d3e769ee7916577ccda5cd36b4447f4d4b
data/Gemfile CHANGED
@@ -1,13 +1,15 @@
1
- source "https://rubygems.org"
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 "rake"
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
- TODO: Delete this and the text above, and describe your gem
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
- TODO: Write usage instructions here
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/[USERNAME]/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/[USERNAME]/weather_by_dcq/blob/master/CODE_OF_CONDUCT.md).
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/[USERNAME]/weather_by_dcq/blob/master/CODE_OF_CONDUCT.md).
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
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "weather_by_dcq"
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 "irb"
14
+ require 'irb'
14
15
  IRB.start(__FILE__)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  require 'bundler/setup'
3
4
  require 'weather_ferret'
@@ -5,4 +5,4 @@ require_relative '../lib/weather_by_dcq/request'
5
5
  require_relative '../lib/weather_by_dcq/forecast'
6
6
  require_relative '../lib/weather_by_dcq/view'
7
7
 
8
-
8
+ WeatherByDcq::View.new.menu
@@ -28,15 +28,14 @@ class WeatherByDcq::Forecast
28
28
  spinner.success
29
29
 
30
30
  @forecast = WeatherByDcq::Request.fetch(location)
31
- puts ""
32
- puts "🌐 "+@forecast['timezone']
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
@@ -33,5 +33,6 @@ class WeatherByDcq::Request
33
33
  c.api_key = '4aac124157c348289553a5e7fdc1899d'
34
34
  c.default_params = { time: 600, exclude: 'minutely, hourly' }
35
35
  end
36
+ @forecast = ForecastIO.forecast(@lat, @lon)
36
37
  end
37
38
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WeatherByDcq
4
- VERSION = '0.1.1'.freeze
4
+ VERSION = '0.1.2'
5
5
  end
@@ -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 = "weather_by_dcq"
8
+ spec.name = 'weather_by_dcq'
7
9
  spec.version = WeatherByDcq::VERSION
8
- spec.authors = ["Doan Trung Quan"]
9
- spec.email = ["doantrungquan97@gmail.com"]
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["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."
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 = Dir.chdir(File.expand_path('..', __FILE__)) do
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 = "exe"
28
+ spec.bindir = 'exe'
29
29
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
- spec.require_paths = ["lib"]
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'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weather_by_dcq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doan Trung Quan