Class: SbPotholes::Pothole
- Inherits:
-
Object
- Object
- SbPotholes::Pothole
- Defined in:
- lib/sb_potholes.rb
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#street_address ⇒ Object
readonly
Returns the value of attribute street_address.
-
#type_of_service_request ⇒ Object
readonly
Returns the value of attribute type_of_service_request.
-
#ward ⇒ Object
readonly
Returns the value of attribute ward.
-
#zip ⇒ Object
readonly
Returns the value of attribute zip.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ Pothole
constructor
A new instance of Pothole.
Constructor Details
#initialize(hash) ⇒ Pothole
Returns a new instance of Pothole.
8 9 10 11 12 13 14 |
# File 'lib/sb_potholes.rb', line 8 def initialize(hash) @status = hash["status"] @street_address = hash["street_address"] @type_of_service_request = hash["type_of_service_request"] @ward = hash["ward"] @zip = hash["zip"] end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/sb_potholes.rb', line 6 def status @status end |
#street_address ⇒ Object (readonly)
Returns the value of attribute street_address.
6 7 8 |
# File 'lib/sb_potholes.rb', line 6 def street_address @street_address end |
#type_of_service_request ⇒ Object (readonly)
Returns the value of attribute type_of_service_request.
6 7 8 |
# File 'lib/sb_potholes.rb', line 6 def type_of_service_request @type_of_service_request end |
#ward ⇒ Object (readonly)
Returns the value of attribute ward.
6 7 8 |
# File 'lib/sb_potholes.rb', line 6 def ward @ward end |
#zip ⇒ Object (readonly)
Returns the value of attribute zip.
6 7 8 |
# File 'lib/sb_potholes.rb', line 6 def zip @zip end |
Class Method Details
.all ⇒ Object
16 17 18 19 |
# File 'lib/sb_potholes.rb', line 16 def self.all potholes_array = Unirest.get("https://data.cityofchicago.org/resource/787j-mys9.json").body convert_hashes_to_objects(potholes_array) end |
.search(search_term) ⇒ Object
21 22 23 24 |
# File 'lib/sb_potholes.rb', line 21 def self.search(search_term) potholes_array = Unirest.get("https://data.cityofchicago.org/resource/787j-mys9.json?$q=#{search_term}").body convert_hashes_to_objects(potholes_array) end |