weatherbot 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ad6c279391403c6c01b6b1606bcf5b6dff3bca53
4
+ data.tar.gz: 135a9f503504c4f3fb05099c60250d9278adad36
5
+ SHA512:
6
+ metadata.gz: 46a1444d790e69047a1e5a2a7d5995a5c93f6ae905b923fd6ae0b91dbaf6361113a345457dcdd8feb7ddaee0687928a32de1c74626e3e96dce7e33f98ec64120
7
+ data.tar.gz: 4e0e4a600c0a31b5243edc8cc889a87ab617ae2061625c930ecd9e459b4bc43de9aee4e6d692e747b8277338b2df0640c11f738a6faca97a17afd8523ca53486
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /.DS_Store
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.15.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at TheInvalidNonce@users.noreply.github.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+
4
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
+
6
+ # Specify your gem's dependencies in weatherbot.gemspec
7
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 TheInvalidNonce
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # Weatherbot
2
+
3
+ A Ruby CLI wrapper using the OpenWeatherMap.org API with interactive features that allow you to search any location's current weather, quick link to the map in Google Maps, and also display the 3 day forecast.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'weatherbot'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install weatherbot
20
+
21
+ ## Usage
22
+ Weatherbot is a Ruby gem that utilizes OpenWeatherMap’s API to retrieve current and forecast weather conditions based on a user’s input.
23
+
24
+ You will be prompted to enter a location. Anywhere works, the API responds to almost any entry, even if it is misspelled.
25
+
26
+ Many popular locations will work. In order to get the most accurate results, typing in <location>, <country> will work in almost every query.
27
+
28
+ The data is outputted to the terminal and shows:
29
+
30
+ - The Report Time and the timezone your computer is in
31
+ - The API response best guess of the location you typed with the country code
32
+ - The coordinates of the weather station that returned the data
33
+ - A google maps link to the coordinates
34
+ - Current temperature & conditions
35
+ - Cloudiness
36
+ - Humidity
37
+ - Wind Speed & Direction
38
+ - Sunrise and Sunset
39
+
40
+ You can type ‘forecast’ to display the results’ 3 days weather forecast in 24 hour intervals.
41
+
42
+ After typing in a location, you can type ‘map’ to open your OS browser to the Google Maps coordinates of the result.
43
+
44
+ To quit the program type ‘exit’.
45
+
46
+ ## Development
47
+
48
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
49
+
50
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
51
+
52
+ ## Contributing
53
+
54
+ Bug reports and pull requests are welcome on GitHub at https://github.com/TheInvalidNonce/weatherbot. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
55
+
56
+ ## License
57
+
58
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
59
+
60
+ ## Code of Conduct
61
+
62
+ Everyone interacting in the Weatherbot project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/TheInvalidNonce/weatherbot/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "weatherbot"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bin/weatherbot ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # require "bundler/setup"
4
+ # require "httparty"
5
+ # require "pry"
6
+ require "./lib/weatherbot"
7
+
8
+ Weatherbot::CLI.new.call
data/lib/weatherbot.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'httparty'
2
+ require 'pry'
3
+
4
+ require_relative "./weatherbot/version"
5
+ require_relative "./weatherbot/cli"
6
+ require_relative "./weatherbot/helper"
7
+ require_relative "./weatherbot/api"
@@ -0,0 +1,156 @@
1
+
2
+ class Weatherbot::API < Helper
3
+ attr_accessor :location, :response_code, :coordinates, :country, :location_name, :temp_avg, :temp_celsius, :condition, :cloudiness, :humidity, :wind_speed, :wind_direction, :report_time, :google_maps, :google_maps_link, :sunrise, :sunset, :hr24_dt, :hr48_dt, :hr72_dt, :temp24, :temp48, :temp72, :condition24, :condition48, :condition72, :cloudiness24, :cloudiness48, :cloudiness72, :humidity24, :humidity48, :humidity72, :wind_speed24, :wind_speed48, :wind_speed72, :wind_direction24, :wind_direction48, :wind_direction72
4
+
5
+ def initialize
6
+ @location = location
7
+ end
8
+
9
+ # Takes user input to enter into URL query & gets current weather conditions in imperial units
10
+ def self.current_weather(location)
11
+ # query sample: 'https://api.openweathermap.org/data/2.5/weather?q=new+york&appid=3207703ee5d0d14e6b6a53d10071018f&units=imperial'
12
+ response = HTTParty.get("https://api.openweathermap.org/data/2.5/weather?q=#{location}&appid=3207703ee5d0d14e6b6a53d10071018f&units=imperial")
13
+ parsed = response.parsed_response
14
+ @current = self.new
15
+ @current.response_code = parsed["cod"]
16
+
17
+ # Check for invalid entry
18
+ if @current.response_code === "404"
19
+ puts "\n\nInvalid location, please enter a valid location.\n\n"
20
+ return
21
+ else
22
+ # Assign attributes to current weather object
23
+ @current.coordinates = parsed["coord"].values.reverse.join(", ")
24
+ @current.location_name = parsed["name"]
25
+ @current.report_time = Time.at(parsed["dt"])
26
+ @current.temp_avg = parsed["main"]["temp"]
27
+ @current.condition = parsed["weather"].first["description"]
28
+ @current.cloudiness = parsed["clouds"]["all"]
29
+ # @current.pressure = parsed["main"]["pressure"]
30
+ @current.humidity = parsed["main"]["humidity"]
31
+ @current.wind_speed = parsed["wind"]["speed"]
32
+ @current.sunrise = Time.at(parsed["sys"]["sunrise"])
33
+ @current.sunset = Time.at(parsed["sys"]["sunset"])
34
+ @current.wind_direction = degToCompass(parsed["wind"]["deg"])
35
+ @current.temp_celsius = toCelsius(parsed["main"]["temp"])
36
+
37
+ # Open query in browser to Google Maps
38
+ @current.google_maps = "https://www.google.com/maps/place/#{@current.coordinates.gsub(" ", "")}"
39
+ @google_maps_link = @current.google_maps
40
+
41
+ # Check for odd locations with no country key
42
+ if parsed.fetch("sys").has_key?("country")
43
+ @current.country = parsed["sys"]["country"]
44
+ else
45
+ @current.country = nil
46
+ end
47
+
48
+ puts "\n\nReport Time: #{@current.report_time}"
49
+ puts "Location: #{@current.location_name}, #{@current.country}"
50
+ puts "Coordinates: #{@current.coordinates}"
51
+ puts "Google Maps: #{@current.google_maps}"
52
+ puts "\nTemperature: #{@current.temp_avg}ºF / #{@current.temp_celsius}ºC"
53
+ puts "Condition: #{@current.condition.capitalize}"
54
+ puts "Cloudiness: #{@current.cloudiness}%"
55
+ puts "\nHumidity: #{@current.humidity}%"
56
+ puts "Wind Speed: #{@current.wind_speed} mph"
57
+ puts "Wind Direction: #{@current.wind_direction}"
58
+ puts "\nSunrise: #{@current.sunrise}"
59
+ puts "Sunset: #{@current.sunset}"
60
+ end
61
+ end
62
+
63
+
64
+ # Takes user input to enter into URL query for 3 day forecast in imperial units
65
+ def self.forecast(location)
66
+ # query sample: https://api.openweathermap.org/data/2.5/forecast?q=new+york&appid=3207703ee5d0d14e6b6a53d10071018f&units=imperial
67
+ response = HTTParty.get("https://api.openweathermap.org/data/2.5/forecast?q=#{location}&appid=3207703ee5d0d14e6b6a53d10071018f&units=imperial")
68
+ parsed = response.parsed_response
69
+ forecast = self.new
70
+
71
+ forecast.location_name = @current.location_name
72
+ # 24/48/72hr date
73
+ forecast.hr24_dt = parsed["list"][8]["dt_txt"]
74
+ forecast.hr48_dt = parsed["list"][16]["dt_txt"]
75
+ forecast.hr72_dt = parsed["list"][24]["dt_txt"]
76
+ # 24/48/72hr temp
77
+ forecast.temp24 = parsed["list"][8]["main"]["temp"]
78
+ forecast.temp48 = parsed["list"][16]["main"]["temp"]
79
+ forecast.temp72 = parsed["list"][24]["main"]["temp"]
80
+ # 24/48/72hr condition
81
+ forecast.condition24 = parsed["list"][8]["weather"][0]["description"]
82
+ forecast.condition48 = parsed["list"][16]["weather"][0]["description"]
83
+ forecast.condition72 = parsed["list"][24]["weather"][0]["description"]
84
+ # 24/48/72hr cloudiness
85
+ forecast.cloudiness24 = parsed["list"][8]["clouds"]["all"]
86
+ forecast.cloudiness48 = parsed["list"][16]["clouds"]["all"]
87
+ forecast.cloudiness72 = parsed["list"][24]["clouds"]["all"]
88
+ # 24/48/72hr humidity
89
+ forecast.humidity24 = parsed["list"][8]["main"]["humidity"]
90
+ forecast.humidity48 = parsed["list"][16]["main"]["humidity"]
91
+ forecast.humidity72 = parsed["list"][24]["main"]["humidity"]
92
+ # 24/48/72hr wind speed & direction
93
+ forecast.wind_speed24 = parsed["list"][8]["wind"]["speed"]
94
+ forecast.wind_speed48 = parsed["list"][16]["wind"]["speed"]
95
+ forecast.wind_speed72 = parsed["list"][24]["wind"]["speed"]
96
+ forecast.wind_direction24 = degToCompass(parsed["list"][8]["wind"]["deg"])
97
+ forecast.wind_direction48 = degToCompass(parsed["list"][16]["wind"]["deg"])
98
+ forecast.wind_direction72 = degToCompass(parsed["list"][24]["wind"]["deg"])
99
+
100
+ # Open query in browser to Google Maps
101
+ forecast.google_maps = "https://www.google.com/maps/place/#{@current.coordinates.gsub(" ", "")}"
102
+ @google_maps_link = @current.google_maps
103
+
104
+ # Output 3 day forecast
105
+ puts "\n-------------------------------\n"
106
+ puts "\n\nIn 24 Hours:"
107
+ puts "\nReport Time: #{forecast.hr24_dt}"
108
+ puts "Location: #{forecast.location_name}, #{@current.country}"
109
+ puts "Google Maps: #{forecast.google_maps}"
110
+ puts "\nTemperature: #{forecast.temp24}ºF / #{toCelsius(forecast.temp24)}ºC"
111
+ puts "Condition: #{forecast.condition24.capitalize}"
112
+ puts "Cloudiness: #{forecast.cloudiness24}%"
113
+ puts "\nHumidity: #{forecast.humidity24}%"
114
+ puts "Wind Speed: #{forecast.wind_speed24} mph"
115
+ puts "Wind Direction: #{forecast.wind_direction24}"
116
+
117
+ puts "\n-------------------------------\n"
118
+ puts "\n\nIn 48 Hours:"
119
+ puts "\nReport Time: #{forecast.hr48_dt}"
120
+ puts "Location: #{forecast.location_name}, #{@current.country}"
121
+ puts "Google Maps: #{forecast.google_maps}"
122
+ puts "\nTemperature: #{forecast.temp48}ºF / #{toCelsius(forecast.temp48)}ºC"
123
+ puts "Condition: #{forecast.condition48.capitalize}"
124
+ puts "Cloudiness: #{forecast.cloudiness48}%"
125
+ puts "\nHumidity: #{forecast.humidity48}%"
126
+ puts "Wind Speed: #{forecast.wind_speed48} mph"
127
+ puts "Wind Direction: #{forecast.wind_direction48}"
128
+
129
+ puts "\n-------------------------------\n"
130
+ puts "\n\nIn 72 Hours:"
131
+ puts "\nReport Time: #{forecast.hr72_dt}"
132
+ puts "Location: #{forecast.location_name}, #{@current.country}"
133
+ puts "Google Maps: #{forecast.google_maps}"
134
+ puts "\nTemperature: #{forecast.temp72}ºF / #{toCelsius(forecast.temp72)}ºC"
135
+ puts "Condition: #{forecast.condition72.capitalize}"
136
+ puts "Cloudiness: #{forecast.cloudiness72}%"
137
+ puts "\nHumidity: #{forecast.humidity72}%"
138
+ puts "Wind Speed: #{forecast.wind_speed72} mph"
139
+ puts "Wind Direction: #{forecast.wind_direction72}"
140
+
141
+ end
142
+
143
+ # Method to open link in Google Maps depending on OS
144
+ def self.open_link
145
+ link = @google_maps_link
146
+ if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
147
+ system "start #{link}"
148
+ elsif RbConfig::CONFIG['host_os'] =~ /darwin/
149
+ system "open #{link}"
150
+ elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
151
+ system "xdg-open #{link}"
152
+ end
153
+ end
154
+
155
+
156
+ end
@@ -0,0 +1,84 @@
1
+ # CLI Controller
2
+
3
+ class Weatherbot::CLI
4
+
5
+ def call
6
+ puts "
7
+ __ __ ___ ___ __ __ __
8
+ | | | || | | | | | | |_| |
9
+ | |_| || | | | |__| | |
10
+ | || | | | | |
11
+ | || | ___ | | | |
12
+ | _ || | |_ | | | | ||_|| |
13
+ |__| |__||___| |_| |___| |_| |_|
14
+ _ _ _______ _______ _______ __ __ _______ ______ _______ _______ _______ __
15
+ | | _ | || || _ || || | | || || _ | | _ || || || |
16
+ | || || || ___|| |_| ||_ _|| |_| || ___|| | || | |_| || _ ||_ _|| |
17
+ | || |___ | | | | | || |___ | |_||_ | || | | | | | | |
18
+ | || ___|| | | | | || ___|| __ || _ | | |_| | | | |__|
19
+ | _ || |___ | _ | | | | _ || |___ | | | || |_| || | | | __
20
+ |__| |__||_______||__| |__| |___| |__| |__||_______||___| |_||_______||_______| |___| |__|
21
+
22
+ "
23
+ sleep(1)
24
+
25
+ intro
26
+ menu
27
+ end
28
+
29
+ def intro
30
+ puts "\n\nI'm a command line interface Ruby gem that gives you current and forecast weather for any location in the world!\n\n"
31
+ end
32
+
33
+ def menu
34
+ input = nil
35
+
36
+ while input != "exit"
37
+
38
+ puts "\n-------------------------------\n"
39
+ puts "\nPlease enter a specific location in the format: <location>, <country> to check the current weather conditions for that location. You can also search by <location>, <state/region>, <country> to find the correct specific location.
40
+ \nType 'map' to open the most relevant result in your OS default browser.
41
+ \n*NOTE: This will open your web browser to the most likely location coordinates in Google Maps.*
42
+ \nYou can also type 'forecast' to display the 3 day forecast of the most recent search. To quit, type 'exit'.\n"
43
+ puts "\n-------------------------------\n"
44
+
45
+ input = gets.chomp.downcase
46
+
47
+ # Check if user wants to exit
48
+ if input === "exit"
49
+ puts "\n\n\nSee you again soon!\n\n\n"
50
+ exit
51
+ end
52
+
53
+ if input === "forecast" || input === "map"
54
+ puts "\n\n\nYou need to input a location first!\n\n\n"
55
+ menu
56
+ end
57
+
58
+ # Display current weather
59
+ Weatherbot::API.current_weather(input)
60
+ new_input = gets.chomp.downcase
61
+
62
+ # Check for specific input commands
63
+ if new_input === "exit"
64
+ puts "\n\n\nSee you again soon!\n\n\n"
65
+ exit
66
+ end
67
+ # Display forecast or location map
68
+ if new_input === "forecast"
69
+ Weatherbot::API.forecast(input)
70
+ menu
71
+ elsif new_input === "map"
72
+ Weatherbot::API.open_link
73
+ menu
74
+ else
75
+ input = nil
76
+ menu
77
+ end
78
+
79
+ end
80
+
81
+ end
82
+
83
+
84
+ end
@@ -0,0 +1,16 @@
1
+ class Helper
2
+
3
+ # Helper function to convert degrees to wind direction
4
+ def self.degToCompass(wind_deg)
5
+ val = ((wind_deg.to_f / 22.5) + 0.5).floor
6
+ direction_arr = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"]
7
+ return direction_arr[(val % 16)]
8
+ end
9
+
10
+ # Helper function to convert to Celsius
11
+ def self.toCelsius(temp_f)
12
+ ((temp_f - 32) * (5.0 / 9.0)).round(2)
13
+ end
14
+
15
+
16
+ end
@@ -0,0 +1,3 @@
1
+ module Weatherbot
2
+ VERSION = "0.1.1"
3
+ end
data/spec.md ADDED
@@ -0,0 +1,6 @@
1
+ # Specifications for the CLI Assessment
2
+
3
+ Specs:
4
+ - [x] Have a CLI for interfacing with the application
5
+ - [x] Pull data from an external source
6
+ - [ ] Implement both list and detail views
@@ -0,0 +1,37 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "weatherbot/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "weatherbot"
8
+ spec.version = Weatherbot::VERSION
9
+ spec.authors = ["Janusz Szubert"]
10
+ spec.email = ["TheInvalidNonce@gmail.com"]
11
+
12
+ spec.summary = %q{A Ruby CLI wrapper using the OpenWeatherMap.org API}
13
+ spec.description = %q{A Ruby CLI wrapper using the OpenWeatherMap.org API with interactive features that allow you to search any location's current weather and 3 day forecast.}
14
+ spec.homepage = "https://github.com/TheInvalidNonce/weatherbot-cli-app"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
21
+ # else
22
+ # raise "RubyGems 2.0 or newer is required to protect against " \
23
+ # "public gem pushes."
24
+ # end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.15"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rspec", "~> 3.0"
36
+ spec.add_development_dependency "httparty", "~> 0.1"
37
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: weatherbot
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Janusz Szubert
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-10-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: httparty
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.1'
69
+ description: A Ruby CLI wrapper using the OpenWeatherMap.org API with interactive
70
+ features that allow you to search any location's current weather and 3 day forecast.
71
+ email:
72
+ - TheInvalidNonce@gmail.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - CODE_OF_CONDUCT.md
81
+ - Gemfile
82
+ - LICENSE.txt
83
+ - README.md
84
+ - Rakefile
85
+ - bin/console
86
+ - bin/setup
87
+ - bin/weatherbot
88
+ - lib/weatherbot.rb
89
+ - lib/weatherbot/api.rb
90
+ - lib/weatherbot/cli.rb
91
+ - lib/weatherbot/helper.rb
92
+ - lib/weatherbot/version.rb
93
+ - spec.md
94
+ - weatherbot.gemspec
95
+ homepage: https://github.com/TheInvalidNonce/weatherbot-cli-app
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.6.13
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: A Ruby CLI wrapper using the OpenWeatherMap.org API
119
+ test_files: []