class GreatSchools::Review

GreatSchools Review

Attributes

comments[RW]
posted_date[RW]
rating[RW]
school_address[RW]
school_name[RW]
submitter[RW]

Public Class Methods

for_city(state, city, options = {}) click to toggle source

Returns a list of the most recent reviews for any schools in a city.

Attributes

  • state - Two letter state abbreviation

  • city - Name of city

Options

  • :cutoff_age - Reviews must have been published after this many days

    ago to be returned.
  • :limit - Maximum number of reviews to return. This defaults to 5.

# File lib/great_schools/review.rb, line 20
def for_city(state, city, options = {})
  options[:cutoffAge] = options.delete(:cutoff_age) # TODO: make helper method to camelCase or map query attributes

  response = GreatSchools::API.get("reviews/city/#{state.upcase}/#{parameterize(city)}", options.slice(:cutoffAge, :limit))

  Array.wrap(response).map { |review| new(review) }
end
for_school(state, id, options = {}) click to toggle source

Returns a list of the most recent reviews 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+

Options

  • :limit - Maximum number of reviews to return. This defaults to 5.

# File lib/great_schools/review.rb, line 40
def for_school(state, id, options = {})
  response = GreatSchools::API.get("reviews/school/#{state.upcase}/#{id}", options.slice(:limit))

  Array.wrap(response).map { |review| new(review) }
end