Class: GreatSchools::Review
Overview
GreatSchools Review
Instance Attribute Summary collapse
-
#comments ⇒ Object
Returns the value of attribute comments.
-
#posted_date ⇒ Object
Returns the value of attribute posted_date.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#review_link ⇒ Object
Returns the value of attribute review_link.
-
#school_address ⇒ Object
Returns the value of attribute school_address.
-
#school_name ⇒ Object
Returns the value of attribute school_name.
-
#submitter ⇒ Object
Returns the value of attribute submitter.
Class Method Summary collapse
-
.for_city(state, city, options = {}) ⇒ Object
Returns a list of the most recent reviews for any schools in a city.
-
.for_school(state, id, options = {}) ⇒ Object
Returns a list of the most recent reviews for a school.
Methods inherited from Model
Constructor Details
This class inherits a constructor from GreatSchools::Model
Instance Attribute Details
#comments ⇒ Object
Returns the value of attribute comments.
5 6 7 |
# File 'lib/great_schools/review.rb', line 5 def comments @comments end |
#posted_date ⇒ Object
Returns the value of attribute posted_date.
5 6 7 |
# File 'lib/great_schools/review.rb', line 5 def posted_date @posted_date end |
#rating ⇒ Object
Returns the value of attribute rating.
5 6 7 |
# File 'lib/great_schools/review.rb', line 5 def @rating end |
#review_link ⇒ Object
Returns the value of attribute review_link.
5 6 7 |
# File 'lib/great_schools/review.rb', line 5 def review_link @review_link end |
#school_address ⇒ Object
Returns the value of attribute school_address.
4 5 6 |
# File 'lib/great_schools/review.rb', line 4 def school_address @school_address end |
#school_name ⇒ Object
Returns the value of attribute school_name.
4 5 6 |
# File 'lib/great_schools/review.rb', line 4 def school_name @school_name end |
#submitter ⇒ Object
Returns the value of attribute submitter.
5 6 7 |
# File 'lib/great_schools/review.rb', line 5 def submitter @submitter end |
Class Method Details
.for_city(state, city, options = {}) ⇒ Object
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 daysago to be returned.
-
:limit
- Maximum number of reviews to return. This defaults to 5.
20 21 22 23 24 25 26 |
# File 'lib/great_schools/review.rb', line 20 def for_city(state, city, = {}) [:cutoffAge] = .delete(:cutoff_age) # TODO: make helper method to camelCase or map query attributes response = GreatSchools::API.get("reviews/city/#{state.upcase}/#{parameterize(city)}", .slice(:cutoffAge, :limit)) Array.wrap(response).map { |review| new(review) } end |
.for_school(state, id, options = {}) ⇒ Object
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 inother listing requests like +GreatSchools::School#browse+ and +GreatSchools::School#nearby+
Options
-
:limit
- Maximum number of reviews to return. This defaults to 5.
40 41 42 43 44 |
# File 'lib/great_schools/review.rb', line 40 def for_school(state, id, = {}) response = GreatSchools::API.get("reviews/school/#{state.upcase}/#{id}", .slice(:limit)) Array.wrap(response).map { |review| new(review) } end |