Class: GreatSchools::Census

Inherits:
Model
  • Object
show all
Defined in:
lib/great_schools/census.rb

Overview

School Census and Profile Data

While you can pull census data for a school manually, I’d recommend going through the school model and letting it make the call for you:

schools = GreatSchools::School.browse('CA', 'San Mateo')
school = schools.first
school.census # equivalent to: GreatSchools::Census.for_school(school.state, school.id)

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Model

#initialize

Constructor Details

This class inherits a constructor from GreatSchools::Model

Instance Attribute Details

#addressObject

– NOTE: these are all GreatSchool::School attributes, should we build a school model instead of attaching these attributes? ++



15
16
17
# File 'lib/great_schools/census.rb', line 15

def address
  @address
end

#districtObject

– NOTE: these are all GreatSchool::School attributes, should we build a school model instead of attaching these attributes? ++



15
16
17
# File 'lib/great_schools/census.rb', line 15

def district
  @district
end

#enrollmentObject

– NOTE: these are all GreatSchool::School attributes, should we build a school model instead of attaching these attributes? ++



15
16
17
# File 'lib/great_schools/census.rb', line 15

def enrollment
  @enrollment
end

#ethnicitiesObject

Returns the value of attribute ethnicities.



17
18
19
# File 'lib/great_schools/census.rb', line 17

def ethnicities
  @ethnicities
end

#free_and_reduced_price_lunchObject

Returns the value of attribute free_and_reduced_price_lunch.



17
18
19
# File 'lib/great_schools/census.rb', line 17

def free_and_reduced_price_lunch
  @free_and_reduced_price_lunch
end

#latitudeObject

– NOTE: these are all GreatSchool::School attributes, should we build a school model instead of attaching these attributes? ++



15
16
17
# File 'lib/great_schools/census.rb', line 15

def latitude
  @latitude
end

#longitudeObject

– NOTE: these are all GreatSchool::School attributes, should we build a school model instead of attaching these attributes? ++



15
16
17
# File 'lib/great_schools/census.rb', line 15

def longitude
  @longitude
end

#phoneObject

– NOTE: these are all GreatSchool::School attributes, should we build a school model instead of attaching these attributes? ++



15
16
17
# File 'lib/great_schools/census.rb', line 15

def phone
  @phone
end

#school_nameObject

– NOTE: these are all GreatSchool::School attributes, should we build a school model instead of attaching these attributes? ++



15
16
17
# File 'lib/great_schools/census.rb', line 15

def school_name
  @school_name
end

#student_teacher_ratioObject

Returns the value of attribute student_teacher_ratio.



17
18
19
# File 'lib/great_schools/census.rb', line 17

def student_teacher_ratio
  @student_teacher_ratio
end

#typeObject

– NOTE: these are all GreatSchool::School attributes, should we build a school model instead of attaching these attributes? ++



15
16
17
# File 'lib/great_schools/census.rb', line 15

def type
  @type
end

Class Method Details

.for_school(state, id) ⇒ Object

Returns census and profile data for a school.

Attributes

  • state - Two letter state abbreviation

  • id - Numeric id of a school. This GreatSchools ID is included in

    other listing requests like +GreatSchools::School#browse+
    and +GreatSchools::School#nearby+
    


28
29
30
31
32
# File 'lib/great_schools/census.rb', line 28

def for_school(state, id)
  response = GreatSchools::API.get("school/census/#{state.upcase}/#{id}")

  new(response)
end