Class: Api
- Inherits:
-
Object
- Object
- Api
- Defined in:
- lib/FreeWiFiNYC/api.rb
Instance Attribute Summary collapse
-
#borough_name ⇒ Object
Returns the value of attribute borough_name.
-
#neighborhood_name ⇒ Object
Returns the value of attribute neighborhood_name.
Class Method Summary collapse
Instance Attribute Details
#borough_name ⇒ Object
Returns the value of attribute borough_name.
3 4 5 |
# File 'lib/FreeWiFiNYC/api.rb', line 3 def borough_name @borough_name end |
#neighborhood_name ⇒ Object
Returns the value of attribute neighborhood_name.
3 4 5 |
# File 'lib/FreeWiFiNYC/api.rb', line 3 def neighborhood_name @neighborhood_name end |
Class Method Details
.neighborhood ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/FreeWiFiNYC/api.rb', line 7 def self.neighborhood puts "This is a list of the Wifi locations by neighborhood in #{Cli.borough_name}.\n" neighborhood_array = [] # @data.each do |each_entry| Scraper.all_data.each do |each_entry| if each_entry["boroname"] == Cli.borough_name neighborhood_list = "#{each_entry["ntaname"]} - #{each_entry["location_t"]} - #{each_entry["location"]}" neighborhood_array << neighborhood_list unless neighborhood_array.include?(neighborhood_list) end end puts neighborhood_array.sort Cli.search_again_met end |
.neighborhood_list ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/FreeWiFiNYC/api.rb', line 41 def self.neighborhood_list puts "Please select a #{@borough} neighborhood." neighborhood_array = [] neighboorhood_hash = Hash.new # @data.each do |each_entry| Scraper.all_data.each do |each_entry| if each_entry["boroname"] == Cli.borough_name neighborhood_list = "#{each_entry["ntaname"]}" neighborhood_array << neighborhood_list unless neighborhood_array.include?(neighborhood_list) end #if end #do PROBABLY GOING TO HAVE TO END THIS DO LOOP IF FAILED neighborhood_array.sort.each.with_index(1) do |neighborhood,i| puts "#{i} - #{neighborhood}" neighboorhood_hash[i] = neighborhood end #do puts "\nPlease select a neighborhood to search." neighborhood_search = gets.chomp.upcase # @data.each do |each_entry| Scraper.all_data.each do |each_entry| neighborhood_list_array = [] if each_entry["ntaname"] == neighboorhood_hash[neighborhood_search.to_i] neighborhood_list = "#{each_entry["ntaname"]} - #{each_entry["location_t"]} - #{each_entry["location"]}" neighborhood_list_array << neighborhood_list unless neighborhood_list_array.include?(neighborhood_list) end#if puts neighborhood_list_array.sort end #do Cli.search_again_met end |
.zip_code ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/FreeWiFiNYC/api.rb', line 21 def self.zip_code puts "\nSearching for WiFi in zip code: #{Cli.find_wifi_input}\n\n" puts "\n...\n" puts "......" puts ".........." puts "\n" puts "You can find free WiFi at the following locations: \n" zip_array = [] # @data.each do |each_entry| Scraper.all_data.each do |each_entry| if each_entry["zip"] == Cli.find_wifi_input zip_list = "#{each_entry["ntaname"]} - #{each_entry["location_t"]} - #{each_entry["location"]}" zip_array << zip_list unless zip_array.include?(zip_list) end end puts zip_array.sort Cli.search_again_met end |