air_quality_index 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 412f573ac84675d71e5b64ce569322a749973e87
4
- data.tar.gz: 03f86b91687ee455c6c624040be2c51d1b932c0b
3
+ metadata.gz: b1ee3e1620339090347a5bf86ddf9726ee2987af
4
+ data.tar.gz: 49a16a9decdf18ffc06f04afe7bf2cd9fb61e527
5
5
  SHA512:
6
- metadata.gz: 515f2009cc76b05359c910f17a5b7034678c490396950545027b44dfc6823aeac2c1187d1a9e360403e0b1bd85f85b0ef01b978dc38e21e64f49737b12340ecb
7
- data.tar.gz: 13857101f9c9efe756db83d2e624ede8d423e010fac309fac1158c5be80045540f3be1870e9d3db70b358b72573523dd6e14a48d48abd4072dde2412a6fb7bae
6
+ metadata.gz: ac007b3abb5e3c63551b2c1c8f4422c8e1e0053b38244c5513c3b886cfa5017fda958b82a60b7393bd8de63fb29e4056f256e07b14951a3219a1d277179e57c5
7
+ data.tar.gz: d4a2827b5d822d0a92c1a33be614b8085162d0311187a2ccd2208d35667b915b580a86f5688668d124138666904c3a2e9d98f3c7c18ec93ec744b198b33f6074
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # AirQualityIndex
2
2
 
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/air_quality_index`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ This gem allows users to view the Air Quality Index rankings for specific US zip codes or view national AQI Rankings from AirNow.gov (https://airnow.gov/)
6
4
 
7
5
  ## Installation
8
6
 
@@ -38,4 +36,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/'james
38
36
  ## License
39
37
 
40
38
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
Binary file
@@ -0,0 +1,6 @@
1
+ class AirQualityIndex::City
2
+
3
+ attr_accessor :location_city, :location_state, :todays_index, :location_city, :location_state, :current_aqi_index, :current_health_msg, :current_pm, :current_pm_msg, :current_ozone, :current_ozone_msg, :current_aqi_timestamp, :today_aqi, :today_aqi_msg, :today_ozone, :tomorrow_aqi, :tomorrow_aqi_msg, :tomorrow_ozone, :location_name_full, :index, :message, :link
4
+
5
+
6
+ end
@@ -39,10 +39,18 @@ class AirQualityIndex::CLI
39
39
  #based on user input, call appropriate class method
40
40
  case user_input
41
41
  when '1'
42
- AirQualityIndex::LocalAQI.new.call_from_zip_code
42
+ if self.time_check
43
+ puts data_unavailable_message
44
+ else
45
+ AirQualityIndex::LocalAQI.new.call_from_zip_code
46
+ end
43
47
  self.return_message
44
48
  when '2'
45
- AirQualityIndex::NationwideAQI.new.call
49
+ if self.time_check
50
+ puts data_unavailable_message
51
+ else
52
+ AirQualityIndex::NationwideAQI.new.call
53
+ end
46
54
  self.return_message
47
55
  when '3'
48
56
  AirQualityIndex::AQI_Information.new.call
@@ -64,4 +72,16 @@ class AirQualityIndex::CLI
64
72
  puts ""
65
73
  end
66
74
 
75
+ #check to see if current time is between midnight and 4am EST (Data Unavailable During This Time)
76
+ def time_check
77
+ time = Time.now.getlocal('-04:00')
78
+ time.hour.between?(0,4)
79
+ end
80
+
81
+ #data unavailability message if hours between midnight and 4am EST
82
+ def data_unavailable_message
83
+ puts ''
84
+ puts 'Updates for current conditions are not available between 12:00 a.m. and 4:00a.m. EST.'
85
+ end
86
+
67
87
  end
@@ -1,6 +1,6 @@
1
1
  class AirQualityIndex::LocalAQI
2
2
 
3
- attr_accessor :zip_code, :todays_index, :current_location_city, :current_location_state, :current_aqi_index, :current_health_msg, :current_pm, :current_pm_msg, :current_ozone, :current_ozone_msg, :current_aqi_timestamp, :today_aqi, :today_aqi_msg, :today_ozone, :tomorrow_aqi, :tomorrow_aqi_msg, :tomorrow_ozone, :doc
3
+ attr_accessor :zip_code, :doc, :city
4
4
 
5
5
  #instantiates new instance based on the Local AQI option in the CLI menu
6
6
  def call_from_zip_code
@@ -15,16 +15,6 @@ class AirQualityIndex::LocalAQI
15
15
  self.aqi_info_validation_return(self.doc)
16
16
  end
17
17
 
18
- #instantiates new instance from the Nationwide rankings based on user selection
19
- def call_from_ranking(link)
20
-
21
- #call scraper class method to access html of page based ranking
22
- @doc = AirQualityIndex::Scraper.new.nationwide_scraper_more_info(link)
23
-
24
- #return aqi information for ranked city
25
- self.aqi_info_validation_return(self.doc)
26
- end
27
-
28
18
  # grab zip code from user for local aqi instance
29
19
  def zip_code_grabber
30
20
 
@@ -60,91 +50,115 @@ class AirQualityIndex::LocalAQI
60
50
  end
61
51
  end
62
52
 
63
- #check to see if zip code page information is available based on scraped web site data, otherwise proceed with aqi info pull
64
- def aqi_info_validation_return(html)
53
+ #passes ranked_city instance from the Nationwide rankings based on user selection
54
+ def call_from_ranking(ranked_city)
55
+
56
+ site_link = 'https://airnow.gov/'
57
+
58
+ #call scraper class method to access html of page based ranking
59
+ @doc = AirQualityIndex::Scraper.new.nationwide_scraper_more_info(site_link.concat(ranked_city.link))
60
+
61
+ #return aqi information for ranked city
62
+ self.aqi_info_validation_return(self.doc, ranked_city)
63
+ end
64
+
65
+ #check to see if page information is available based on scraped web site data (based on zip), otherwise proceed with aqi info pull
66
+ def aqi_info_validation_return(html, city = nil)
65
67
 
66
- page_message = self.doc.search("h2").text.strip
68
+ page_message = html.search("h2").text.strip
67
69
 
68
70
  if page_message.include? "does not currently have Air Quality data"
69
71
  puts ""
70
72
  puts page_message
71
73
  else
72
74
  #store information as local instance variables
73
- self.local_aqi_index
75
+ self.local_aqi_index(city)
74
76
  #return aqi index information
75
77
  self.local_aqi_return
76
78
  end
77
79
  end
78
80
 
79
- #grabs timestamp of aqi measurement
80
- def timestamp
81
- timestamp = self.doc.search("td.AQDataSectionTitle").css("small").text.split(" ")
82
- timestamp[0].capitalize!
83
- timestamp = timestamp.join(" ")
84
- timestamp
85
- end
86
-
87
81
  #assign scraped information to instance variables
88
- def local_aqi_index
82
+ def local_aqi_index(city)
89
83
 
90
84
  #Store 'Data Unavailable Message' as variable. Each method below checks for a nil return and sets message if found.
91
85
  unavailable_msg = "Data Not Currently Available"
92
86
 
87
+ #If a ranked city instance is supplied, set @city to this instance, otherwise, create a new city instance
88
+ if city.nil?
89
+ @city = AirQualityIndex::City.new
90
+ else
91
+ @city = ranked_city
92
+ end
93
+
93
94
  #store location information
94
- self.current_location_city = self.doc.search(".ActiveCity").text.strip
95
- self.current_location_state = self.doc.search("a.Breadcrumb")[1].text.strip
95
+ self.city.location_city = self.doc.search(".ActiveCity").text.strip
96
+ self.city.location_state = self.doc.search("a.Breadcrumb")[1].text.strip
96
97
 
97
98
  #store aqi index
98
- self.doc.at('.TblInvisible').css('tr td').children[1].nil?? self.current_aqi_index = unavailable_msg : self.current_aqi_index = self.doc.at('.TblInvisible').css('tr td').children[1].text.strip
99
- self.doc.search("td.HealthMessage")[0].nil?? self.current_health_msg = unavailable_msg : self.current_health_msg = self.doc.search("td.HealthMessage")[0].text.strip[/(?<=Health Message: ).*/]
99
+ self.doc.at('.TblInvisible').css('tr td').children[1].nil?? self.city.current_aqi_index = unavailable_msg : self.city.current_aqi_index = self.doc.at('.TblInvisible').css('tr td').children[1].text.strip
100
+ self.doc.search("td.HealthMessage")[0].nil?? self.city.current_health_msg = unavailable_msg : self.city.current_health_msg = self.doc.search("td.HealthMessage")[0].text.strip[/(?<=Health Message: ).*/]
100
101
 
101
102
  #store current aqi/ozone data
102
- self.doc.search("table")[14].children.css("td")[4].nil?? self.current_pm = unavailable_msg : self.current_pm = self.doc.search("table")[14].children.css("td")[4].text.strip
103
- self.doc.search("td.AQDataPollDetails")[3].nil?? self.current_pm_msg = unavailable_msg : self.current_pm_msg = self.doc.search("td.AQDataPollDetails")[3].text.strip
104
- self.doc.search("table")[14].children.css("td")[1].nil?? self.current_ozone = unavailable_msg : self.current_ozone = self.doc.search("table")[14].children.css("td")[1].text.strip
105
- self.doc.search("td.AQDataPollDetails")[1].nil?? self.current_ozone_msg = unavailable_msg : self.current_ozone_msg = self.doc.search("td.AQDataPollDetails")[1].text.strip
103
+ self.doc.search("table")[14].children.css("td")[4].nil?? self.city.current_pm = unavailable_msg : self.city.current_pm = self.doc.search("table")[14].children.css("td")[4].text.strip
104
+ self.doc.search("td.AQDataPollDetails")[3].nil?? self.city.current_pm_msg = unavailable_msg : self.city.current_pm_msg = self.doc.search("td.AQDataPollDetails")[3].text.strip
105
+ self.doc.search("table")[14].children.css("td")[1].nil?? self.city.current_ozone = unavailable_msg : self.city.current_ozone = self.doc.search("table")[14].children.css("td")[1].text.strip
106
+ self.doc.search("td.AQDataPollDetails")[1].nil?? self.city.current_ozone_msg = unavailable_msg : self.city.current_ozone_msg = self.doc.search("td.AQDataPollDetails")[1].text.strip
106
107
 
107
108
  #Extract time from site
108
- self.current_aqi_timestamp = self.timestamp
109
+ self.city.current_aqi_timestamp = self.timestamp
109
110
 
110
111
  #store todays forecast data
111
- self.doc.search("td.AQDataPollDetails")[7].nil?? self.today_aqi = unavailable_msg : self.today_aqi = self.doc.search("td.AQDataPollDetails")[7].text.strip
112
- self.doc.search("td.HealthMessage")[1].nil?? self.today_aqi_msg = unavailable_msg : self.today_aqi_msg = self.doc.search("td.HealthMessage")[1].text.strip[/(?<=Health Message: ).*/]
113
- self.doc.search("td.AQDataPollDetails")[5].nil?? self.today_ozone = unavailable_msg : self.today_ozone = self.doc.search("td.AQDataPollDetails")[5].text.strip
112
+ self.doc.search("td.AQDataPollDetails")[7].nil?? self.city.today_aqi = unavailable_msg : self.city.today_aqi = self.doc.search("td.AQDataPollDetails")[7].text.strip
113
+ self.doc.search("td.HealthMessage")[1].nil?? self.city.today_aqi_msg = unavailable_msg : self.city.today_aqi_msg = self.doc.search("td.HealthMessage")[1].text.strip[/(?<=Health Message: ).*/]
114
+ self.doc.search("td.AQDataPollDetails")[5].nil?? self.city.today_ozone = unavailable_msg : self.city.today_ozone = self.doc.search("td.AQDataPollDetails")[5].text.strip
114
115
 
115
116
  #store tomorrows forecast data
116
- self.doc.search("td.AQDataPollDetails")[11].nil?? self.tomorrow_aqi = unavailable_msg : self.tomorrow_aqi = self.doc.search("td.AQDataPollDetails")[11].text.strip
117
- self.doc.search("td.HealthMessage")[2].nil?? self.tomorrow_aqi_msg = unavailable_msg : self.tomorrow_aqi_msg = self.doc.search("td.HealthMessage")[2].text.strip[/(?<=Health Message: ).*/]
118
- self.doc.search("td.AQDataPollDetails")[9].nil?? self.tomorrow_ozone = unavailable_msg : self.tomorrow_ozone = self.doc.search("td.AQDataPollDetails")[9].text.strip
117
+ self.doc.search("td.AQDataPollDetails")[11].nil?? self.city.tomorrow_aqi = unavailable_msg : self.city.tomorrow_aqi = self.doc.search("td.AQDataPollDetails")[11].text.strip
118
+ self.doc.search("td.HealthMessage")[2].nil?? self.city.tomorrow_aqi_msg = unavailable_msg : self.city.tomorrow_aqi_msg = self.doc.search("td.HealthMessage")[2].text.strip[/(?<=Health Message: ).*/]
119
+ self.doc.search("td.AQDataPollDetails")[9].nil?? self.city.tomorrow_ozone = unavailable_msg : self.city.tomorrow_ozone = self.doc.search("td.AQDataPollDetails")[9].text.strip
119
120
 
120
121
  #return self
121
122
  self
122
123
  end
123
124
 
125
+ #grabs timestamp of aqi measurement, if none available, sets to "Time Unavailable" and returns
126
+ def timestamp
127
+ timestamp = self.doc.search("td.AQDataSectionTitle").css("small").text.split(" ")
128
+ binding.pry
129
+ if timestamp != []
130
+ timestamp[0].capitalize!
131
+ timestamp = timestamp.join(" ")
132
+ else
133
+ timestamp = 'Time Unavailable'
134
+ end
135
+ timestamp
136
+ end
137
+
124
138
  #return output message with scraped information
125
139
  def local_aqi_return
126
140
 
127
141
  puts <<-DOC
128
142
 
129
- Current Conditions in #{self.current_location_city}, #{self.current_location_state} (#{self.current_aqi_timestamp}):
143
+ Current Conditions in #{self.city.location_city}, #{self.city.location_state} (#{self.city.current_aqi_timestamp}):
130
144
 
131
- AQI: #{self.current_aqi_index}
132
- Health Message: #{self.current_health_msg}
145
+ AQI: #{self.city.current_aqi_index}
146
+ Health Message: #{self.city.current_health_msg}
133
147
 
134
- Ozone: #{self.current_ozone} (#{self.current_ozone_msg})
135
- Particles (PM2.5): #{self.current_pm} (#{self.current_pm_msg})
148
+ Ozone: #{self.city.current_ozone} (#{self.city.current_ozone_msg})
149
+ Particles (PM2.5): #{self.city.current_pm} (#{self.city.current_pm_msg})
136
150
 
137
- Today's Forecast in #{self.current_location_city}, #{self.current_location_state}
151
+ Today's Forecast in #{self.city.location_city}, #{self.city.location_state}
138
152
 
139
- AQI: #{self.today_aqi}
140
- Ozone: #{self.today_ozone}
141
- Health Message: #{self.today_aqi_msg}
153
+ AQI: #{self.city.today_aqi}
154
+ Ozone: #{self.city.today_ozone}
155
+ Health Message: #{self.city.today_aqi_msg}
142
156
 
143
- Tomorrow's Forecast in #{self.current_location_city}, #{self.current_location_state}
157
+ Tomorrow's Forecast in #{self.city.location_city}, #{self.city.location_state}
144
158
 
145
- AQI: #{self.tomorrow_aqi}
146
- Ozone: #{self.tomorrow_ozone}
147
- Health Message: #{self.tomorrow_aqi_msg}
159
+ AQI: #{self.city.tomorrow_aqi}
160
+ Ozone: #{self.city.tomorrow_ozone}
161
+ Health Message: #{self.city.tomorrow_aqi_msg}
148
162
 
149
163
  DOC
150
164
  end
@@ -1,9 +1,10 @@
1
1
  class AirQualityIndex::NationwideAQI
2
2
 
3
- attr_accessor :todays_date, :national_aqi, :first_city, :first_index, :first_message, :second_city, :second_index, :second_message, :third_city, :third_index, :third_message, :fourth_city, :fourth_index, :fourth_message, :fifth_city, :fifth_index, :fifth_message, :html, :first_link, :second_link, :third_link, :fourth_link, :fifth_link
3
+ attr_accessor :todays_date, :national_aqi, :first_city, :second_city, :third_city, :fourth_city, :fifth_city, :html, :selected_city
4
4
 
5
5
  #instantiates a new pull from AirNow.gov for the top 5 current rankings on air pollution
6
6
  def call
7
+
7
8
  self.get_nationwide_data
8
9
  puts self.todays_rankings_output
9
10
  self.get_more_info?
@@ -15,11 +16,11 @@ class AirQualityIndex::NationwideAQI
15
16
  puts "Nationwide AQI Rankings for #{self.todays_date.month}/#{self.todays_date.day}/#{self.todays_date.year}"
16
17
  puts ""
17
18
  puts <<-DOC
18
- 1. #{self.first_city} - #{self.first_index} (#{self.first_message})
19
- 2. #{self.second_city} - #{self.second_index} (#{self.second_message})
20
- 3. #{self.third_city} - #{self.third_index} (#{self.third_message})
21
- 4. #{self.fourth_city} - #{self.fourth_index} (#{self.fourth_message})
22
- 5. #{self.fifth_city} - #{self.fifth_index} (#{self.fifth_message})
19
+ 1. #{self.first_city.location_name_full} - #{self.first_city.index} (#{self.first_city.message})
20
+ 2. #{self.second_city.location_name_full} - #{self.second_city.index} (#{self.second_city.message})
21
+ 3. #{self.third_city.location_name_full} - #{self.third_city.index} (#{self.third_city.message})
22
+ 4. #{self.fourth_city.location_name_full} - #{self.fourth_city.index} (#{self.fourth_city.message})
23
+ 5. #{self.fifth_city.location_name_full} - #{self.fifth_city.index} (#{self.fifth_city.message})
23
24
  DOC
24
25
  end
25
26
 
@@ -34,35 +35,45 @@ class AirQualityIndex::NationwideAQI
34
35
  #scrape page for top ranking cities
35
36
  @html = AirQualityIndex::Scraper.new.nationwide_aqi_scraper
36
37
 
37
- #store first rank data
38
- self.first_city = self.html.search("a.NtnlSummaryCity")[0].text.strip
39
- self.first_index = self.html.search("div.TabbedPanelsContent").children.css("tr td")[1].children.text.strip
40
- self.first_message = aqi_message_set(self.first_index)
41
- self.first_link = html.search("a.NtnlSummaryCity")[0]['href']
38
+ #create and store first rank data
39
+ @first_city = AirQualityIndex::City.new
40
+
41
+ self.first_city.location_name_full = self.html.search("a.NtnlSummaryCity")[0].text.strip
42
+ self.first_city.index = self.html.search("div.TabbedPanelsContent").children.css("tr td")[1].children.text.strip
43
+ self.first_city.message = aqi_message_set(self.first_city.index)
44
+ self.first_city.link = html.search("a.NtnlSummaryCity")[0]['href']
42
45
 
43
46
  #store second rank data
44
- self.second_city = self.html.search("a.NtnlSummaryCity")[1].text.strip
45
- self.second_index = self.html.search("div.TabbedPanelsContent").children.css("tr td")[6].children.text.strip
46
- self.second_message = aqi_message_set(self.second_index)
47
- self.second_link = html.search("a.NtnlSummaryCity")[1]['href']
47
+ @second_city = AirQualityIndex::City.new
48
+
49
+ self.second_city.location_name_full = self.html.search("a.NtnlSummaryCity")[1].text.strip
50
+ self.second_city.index = self.html.search("div.TabbedPanelsContent").children.css("tr td")[6].children.text.strip
51
+ self.second_city.message = aqi_message_set(self.second_city.index)
52
+ self.second_city.link = html.search("a.NtnlSummaryCity")[1]['href']
48
53
 
49
54
  #store third rank data
50
- self.third_city = self.html.search("a.NtnlSummaryCity")[2].text.strip
51
- self.third_index = self.html.search("div.TabbedPanelsContent").children.css("tr td")[11].children.text.strip
52
- self.third_message = aqi_message_set(self.third_index)
53
- self.third_link = html.search("a.NtnlSummaryCity")[2]['href']
55
+ @third_city = AirQualityIndex::City.new
56
+
57
+ self.third_city.location_name_full = self.html.search("a.NtnlSummaryCity")[2].text.strip
58
+ self.third_city.index = self.html.search("div.TabbedPanelsContent").children.css("tr td")[11].children.text.strip
59
+ self.third_city.message = aqi_message_set(self.third_city.index)
60
+ self.third_city.link = html.search("a.NtnlSummaryCity")[2]['href']
54
61
 
55
62
  #store fourth rank data
56
- self.fourth_city = self.html.search("a.NtnlSummaryCity")[3].text.strip
57
- self.fourth_index = self.html.search("div.TabbedPanelsContent").children.css("tr td")[16].children.text.strip
58
- self.fourth_message = aqi_message_set(self.fourth_index)
59
- self.fourth_link = html.search("a.NtnlSummaryCity")[3]['href']
63
+ @fourth_city = AirQualityIndex::City.new
64
+
65
+ self.fourth_city.location_name_full = self.html.search("a.NtnlSummaryCity")[3].text.strip
66
+ self.fourth_city.index = self.html.search("div.TabbedPanelsContent").children.css("tr td")[16].children.text.strip
67
+ self.fourth_city.message = aqi_message_set(self.fourth_city.index)
68
+ self.fourth_city.link = html.search("a.NtnlSummaryCity")[3]['href']
60
69
 
61
70
  #store fifth rank data
62
- self.fifth_city = self.html.search("a.NtnlSummaryCity")[4].text.strip
63
- self.fifth_index = self.html.search("div.TabbedPanelsContent").children.css("tr td")[21].children.text.strip
64
- self.fifth_message = aqi_message_set(self.fifth_index)
65
- self.fifth_link = html.search("a.NtnlSummaryCity")[4]['href']
71
+ @fifth_city = AirQualityIndex::City.new
72
+
73
+ self.fifth_city.location_name_full = self.html.search("a.NtnlSummaryCity")[4].text.strip
74
+ self.fifth_city.index = self.html.search("div.TabbedPanelsContent").children.css("tr td")[21].children.text.strip
75
+ self.fifth_city.message = aqi_message_set(self.fifth_city.index)
76
+ self.fifth_city.link = html.search("a.NtnlSummaryCity")[4]['href']
66
77
 
67
78
  end
68
79
 
@@ -86,14 +97,13 @@ class AirQualityIndex::NationwideAQI
86
97
  end
87
98
  end
88
99
 
89
- #asks user if they would like additional information on any of the ranked cities, if so, pulls individual ranking information via local_aqi method call
100
+ #asks user if they would like additional information on any of the ranked cities, if so, passes selected city instance to the local_aqi method call and then returns instance
90
101
  def get_more_info?
91
102
 
92
103
  puts "Would you like local information for any of the cities listed? Please enter a numerical value 1-5, type 'exit' to end program, or type any other key to return to previous menu."
93
104
  puts ""
94
105
 
95
- link = 'https://airnow.gov/'
96
- city_info = nil
106
+ @selected_city = nil
97
107
 
98
108
  #gets user input
99
109
  user_input = gets.strip.downcase
@@ -101,21 +111,21 @@ class AirQualityIndex::NationwideAQI
101
111
  #depending on user input, sets new local aqi instance to city_info variable
102
112
  case user_input
103
113
  when '1'
104
- city_info = AirQualityIndex::LocalAQI.new.call_from_ranking(link.concat(self.first_link))
114
+ self.selected_city = AirQualityIndex::LocalAQI.new.call_from_ranking(self.first_city)
105
115
  when '2'
106
- city_info = AirQualityIndex::LocalAQI.new.call_from_ranking(link.concat(self.second_link))
116
+ self.selected_city = AirQualityIndex::LocalAQI.new.call_from_ranking(self.second_city)
107
117
  when '3'
108
- city_info = AirQualityIndex::LocalAQI.new.call_from_ranking(link.concat(self.third_link))
118
+ self.selected_city = AirQualityIndex::LocalAQI.new.call_from_ranking(self.third_city)
109
119
  when '4'
110
- city_info = AirQualityIndex::LocalAQI.new.call_from_ranking(link.concat(self.fourth_link))
120
+ self.selected_city = AirQualityIndex::LocalAQI.new.call_from_ranking(self.fourth_city)
111
121
  when '5'
112
- city_info = AirQualityIndex::LocalAQI.new.call_from_ranking(link.concat(self.fifth_link))
122
+ self.selected_city = AirQualityIndex::LocalAQI.new.call_from_ranking(self.fifth_city)
113
123
  when 'exit'
114
124
  exit!
115
125
  end
116
126
 
117
127
  #return city_info if user selected one
118
- city_info.local_aqi_return unless city_info.nil?
128
+ self.selected_city.local_aqi_return unless self.selected_city.nil?
119
129
 
120
130
  end
121
131
 
@@ -1,3 +1,3 @@
1
1
  module AirQualityIndex
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -8,7 +8,8 @@ require_relative "./air_quality_index/cli"
8
8
  require_relative "./air_quality_index/local_aqi"
9
9
  require_relative "./air_quality_index/nationwide_aqi"
10
10
  require_relative "./air_quality_index/aqi_info"
11
- require_relative "./air_quality_index/scraper.rb"
11
+ require_relative "./air_quality_index/scraper"
12
+ require_relative "./air_quality_index/city"
12
13
 
13
14
  module AirQualityIndex
14
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: air_quality_index
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "'Jameson Bass'"
@@ -53,12 +53,14 @@ files:
53
53
  - NOTES.md
54
54
  - README.md
55
55
  - Rakefile
56
+ - air_quality_index-0.1.0.gem
56
57
  - air_quality_index.gemspec
57
58
  - bin/air-quality-index
58
59
  - bin/console
59
60
  - bin/setup
60
61
  - lib/air_quality_index.rb
61
62
  - lib/air_quality_index/aqi_info.rb
63
+ - lib/air_quality_index/city.rb
62
64
  - lib/air_quality_index/cli.rb
63
65
  - lib/air_quality_index/local_aqi.rb
64
66
  - lib/air_quality_index/nationwide_aqi.rb