Class: ChicagoLibraries::Library
- Inherits:
-
Object
- Object
- ChicagoLibraries::Library
- Defined in:
- lib/chicago_libraries.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#city ⇒ Object
Returns the value of attribute city.
-
#cybernavigator ⇒ Object
Returns the value of attribute cybernavigator.
-
#hours ⇒ Object
Returns the value of attribute hours.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#state ⇒ Object
Returns the value of attribute state.
-
#teacher_in_library ⇒ Object
Returns the value of attribute teacher_in_library.
-
#website ⇒ Object
Returns the value of attribute website.
-
#zip_code ⇒ Object
Returns the value of attribute zip_code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(library_info) ⇒ Library
constructor
A new instance of Library.
Constructor Details
#initialize(library_info) ⇒ Library
Returns a new instance of Library.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/chicago_libraries.rb', line 10 def initialize(library_info) @zip_code = library_info["zip"], @phone = library_info["phone"], @teacher_in_library = library_info["teacher_in_the_library"], @longitude = library_info["location"]["longitude"], @latitude = library_info["location"]["latitude"], @website = library_info["website"]["url"], @address = library_info["address"], @hours = library_info["hours_of_operation"], @state = library_info["state"], @cybernavigator = library_info["cybernavigator"], @name = library_info["name_"], @city = library_info["city"] end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
8 9 10 |
# File 'lib/chicago_libraries.rb', line 8 def address @address end |
#city ⇒ Object
Returns the value of attribute city.
8 9 10 |
# File 'lib/chicago_libraries.rb', line 8 def city @city end |
#cybernavigator ⇒ Object
Returns the value of attribute cybernavigator.
8 9 10 |
# File 'lib/chicago_libraries.rb', line 8 def cybernavigator @cybernavigator end |
#hours ⇒ Object
Returns the value of attribute hours.
8 9 10 |
# File 'lib/chicago_libraries.rb', line 8 def hours @hours end |
#latitude ⇒ Object
Returns the value of attribute latitude.
8 9 10 |
# File 'lib/chicago_libraries.rb', line 8 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
8 9 10 |
# File 'lib/chicago_libraries.rb', line 8 def longitude @longitude end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/chicago_libraries.rb', line 8 def name @name end |
#phone ⇒ Object
Returns the value of attribute phone.
8 9 10 |
# File 'lib/chicago_libraries.rb', line 8 def phone @phone end |
#state ⇒ Object
Returns the value of attribute state.
8 9 10 |
# File 'lib/chicago_libraries.rb', line 8 def state @state end |
#teacher_in_library ⇒ Object
Returns the value of attribute teacher_in_library.
8 9 10 |
# File 'lib/chicago_libraries.rb', line 8 def teacher_in_library @teacher_in_library end |
#website ⇒ Object
Returns the value of attribute website.
8 9 10 |
# File 'lib/chicago_libraries.rb', line 8 def website @website end |
#zip_code ⇒ Object
Returns the value of attribute zip_code.
8 9 10 |
# File 'lib/chicago_libraries.rb', line 8 def zip_code @zip_code end |
Class Method Details
.all ⇒ Object
25 26 27 28 |
# File 'lib/chicago_libraries.rb', line 25 def self.all api_array = Unirest.get("https://data.cityofchicago.org/resource/x8fc-8rcq.json").body create_libraries(api_array) end |
.search(search_keyword) ⇒ Object
30 31 32 33 |
# File 'lib/chicago_libraries.rb', line 30 def self.search(search_keyword) api_array = Unirest.get("https://data.cityofchicago.org/resource/x8fc-8rcq.json?$q=#{search_keyword}").body create_libraries(api_array) end |