class GreatSchools::Census

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)

Attributes

address[RW]

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

district[RW]

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

enrollment[RW]

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

ethnicities[RW]
free_and_reduced_price_lunch[RW]
latitude[RW]

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

longitude[RW]

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

phone[RW]

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

school_name[RW]

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

student_teacher_ratio[RW]
type[RW]

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

Public Class Methods

for_school(state, id) click to toggle source

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+
# 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

Public Instance Methods

ethnicities=(params) click to toggle source

Set an array of GreatSchools::Ethnicity.

Attributes

  • params - a Hash or Array of GreatSchools::Ethnicity attributes.

# File lib/great_schools/census.rb, line 40
def ethnicities=(params)
  @ethnicities = []

  params = params['ethnicity'] if params.is_a?(Hash) && params.key?('ethnicity')

  Array.wrap(params).each do |hash|
    @ethnicities << GreatSchools::Ethnicity.new(hash)
  end

  @ethnicities
end