breathe_in 0.3.0 → 0.4.0
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/bin/breathe_in +22 -0
- data/lib/breathe_in/cli.rb +14 -0
- data/lib/breathe_in/scraper.rb +1 -1
- data/lib/breathe_in/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 518500085648f4aaa924eaa5d3ab5198c44a5b47
|
|
4
|
+
data.tar.gz: 27670870139f6d47442a943b9953073b807fbd55
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab340cfefbb7620327796e00d7f77d02d223c5d1172ab453f04e66ecb933ed84733df4b90e49eb8336fdf6cbcd0836ac70f804b7520f5bb953ea7c2af2637ca6
|
|
7
|
+
data.tar.gz: 32a44d843c48b6800841586f9f8e7acd1e5b1685b4fecbd1a26fd8b1fcd06a343aa8305a50c51a9fcb6b593b4d59c1b466266d6b16fe5f5f13b8965353befea4
|
data/bin/breathe_in
CHANGED
|
@@ -4,4 +4,26 @@ require "breathe_in"
|
|
|
4
4
|
|
|
5
5
|
BreatheIn::CLI.new.run
|
|
6
6
|
|
|
7
|
+
# or:
|
|
8
|
+
# require "bundler"
|
|
9
|
+
# Bundler.require
|
|
10
|
+
# this will clear the load path
|
|
11
|
+
# or:
|
|
12
|
+
# require_relative '../lib/breathe_in'
|
|
7
13
|
|
|
14
|
+
# 1. CLI asks for a city.
|
|
15
|
+
# 2. city checks if we have that city, if not
|
|
16
|
+
# 3. Scrape it and create the instance of that city
|
|
17
|
+
# 3. cli has the city
|
|
18
|
+
|
|
19
|
+
# The cli is just relying on the city classes abilit to find a city.
|
|
20
|
+
# City class is relying on the scraper class to get data for itself.
|
|
21
|
+
|
|
22
|
+
# 1. cli.
|
|
23
|
+
# 2. city
|
|
24
|
+
# 3. scraper
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# cli
|
|
28
|
+
# a. scraper
|
|
29
|
+
# or b .city
|
data/lib/breathe_in/cli.rb
CHANGED
|
@@ -28,6 +28,20 @@ class BreatheIn::CLI
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
# def get_information
|
|
32
|
+
# get_zipcode
|
|
33
|
+
# @city = BreatheIn::City.find_by_zipcode({zipcode: self.class.zipcode})
|
|
34
|
+
# scrape_data BreatheIn::City.new({zipcode: self.class.zipcode})
|
|
35
|
+
# if BreatheIn::Scraper.city_name == nil
|
|
36
|
+
# puts "That zipcode is not recognized by AirNow.gov."
|
|
37
|
+
# get_information
|
|
38
|
+
# else
|
|
39
|
+
# new_city = BreatheIn::City.new({zipcode: self.class.zipcode})
|
|
40
|
+
# assign_attributes(new_city)
|
|
41
|
+
# display_information
|
|
42
|
+
# end
|
|
43
|
+
# end
|
|
44
|
+
|
|
31
45
|
def check_site_availability
|
|
32
46
|
if BreatheIn::Scraper.under_maintenance
|
|
33
47
|
disclaimer = <<-Ruby
|
data/lib/breathe_in/scraper.rb
CHANGED
|
@@ -13,7 +13,7 @@ class BreatheIn::Scraper
|
|
|
13
13
|
|
|
14
14
|
def self.scraped_page(zipcode)
|
|
15
15
|
begin
|
|
16
|
-
@@scraped = Nokogiri::HTML(open("http://airnow.gov/?action=airnow.local_city&zipcode
|
|
16
|
+
@@scraped = Nokogiri::HTML(open("http://airnow.gov/?action=airnow.local_city&zipcode=92505&submit=Go", :allow_redirections => :all))
|
|
17
17
|
rescue OpenURI::HTTPError => e
|
|
18
18
|
if e.message == '404 Not Found'
|
|
19
19
|
puts "The website is currently down. Pleaes try again later."
|
data/lib/breathe_in/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: breathe_in
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- eric-an
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-03-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|