Class: SfAircraftNoiseComplaints::Complaint
- Inherits:
-
Object
- Object
- SfAircraftNoiseComplaints::Complaint
- Defined in:
- lib/sf_aircraft_noise_complaints.rb
Instance Attribute Summary collapse
-
#community ⇒ Object
readonly
Returns the value of attribute community.
-
#no_of_callers ⇒ Object
readonly
Returns the value of attribute no_of_callers.
-
#no_of_complaints ⇒ Object
readonly
Returns the value of attribute no_of_complaints.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ Complaint
constructor
A new instance of Complaint.
Constructor Details
#initialize(hash) ⇒ Complaint
Returns a new instance of Complaint.
9 10 11 12 13 14 |
# File 'lib/sf_aircraft_noise_complaints.rb', line 9 def initialize(hash) @community = hash["community"] @year = hash["year"] @no_of_complaints = hash["total_complaints"] @no_of_callers = hash["total_number_of_callers"] end |
Instance Attribute Details
#community ⇒ Object (readonly)
Returns the value of attribute community.
7 8 9 |
# File 'lib/sf_aircraft_noise_complaints.rb', line 7 def community @community end |
#no_of_callers ⇒ Object (readonly)
Returns the value of attribute no_of_callers.
7 8 9 |
# File 'lib/sf_aircraft_noise_complaints.rb', line 7 def no_of_callers @no_of_callers end |
#no_of_complaints ⇒ Object (readonly)
Returns the value of attribute no_of_complaints.
7 8 9 |
# File 'lib/sf_aircraft_noise_complaints.rb', line 7 def no_of_complaints @no_of_complaints end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
7 8 9 |
# File 'lib/sf_aircraft_noise_complaints.rb', line 7 def year @year end |
Class Method Details
.all ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/sf_aircraft_noise_complaints.rb', line 16 def self.all complaints_array = Unirest.get("https://data.sfgov.org/resource/bw78-hmt5.json").body complaints = [] complaints_array.each do |complaint_hash| complaints.push(Complaint.new(complaint_hash)) end return complaints end |