Class: GreatSchools::District

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

Overview

GreatSchools District

– TODO: add method to grab schools using GreatSchools::School#nearby with the address, city, state, and zip_code options (parsing address). Filter results to schools with a matching district name. ++

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

Returns the value of attribute address.



10
11
12
# File 'lib/great_schools/district.rb', line 10

def address
  @address
end

#charter_schoolsObject

Returns the value of attribute charter_schools.



13
14
15
# File 'lib/great_schools/district.rb', line 13

def charter_schools
  @charter_schools
end

#district_ratingObject

Returns the value of attribute district_rating.



11
12
13
# File 'lib/great_schools/district.rb', line 11

def district_rating
  @district_rating
end

#elementary_schoolsObject

Returns the value of attribute elementary_schools.



12
13
14
# File 'lib/great_schools/district.rb', line 12

def elementary_schools
  @elementary_schools
end

#faxObject

Returns the value of attribute fax.



10
11
12
# File 'lib/great_schools/district.rb', line 10

def fax
  @fax
end

#grade_rangeObject

Returns the value of attribute grade_range.



11
12
13
# File 'lib/great_schools/district.rb', line 11

def grade_range
  @grade_range
end

#high_schoolsObject

Returns the value of attribute high_schools.



12
13
14
# File 'lib/great_schools/district.rb', line 12

def high_schools
  @high_schools
end

#middle_schoolsObject

Returns the value of attribute middle_schools.



12
13
14
# File 'lib/great_schools/district.rb', line 12

def middle_schools
  @middle_schools
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/great_schools/district.rb', line 10

def name
  @name
end

#nces_codeObject

Returns the value of attribute nces_code.



11
12
13
# File 'lib/great_schools/district.rb', line 11

def nces_code
  @nces_code
end

#phoneObject

Returns the value of attribute phone.



10
11
12
# File 'lib/great_schools/district.rb', line 10

def phone
  @phone
end

#public_schoolsObject

Returns the value of attribute public_schools.



13
14
15
# File 'lib/great_schools/district.rb', line 13

def public_schools
  @public_schools
end

#total_schoolsObject

Returns the value of attribute total_schools.



11
12
13
# File 'lib/great_schools/district.rb', line 11

def total_schools
  @total_schools
end

#websiteObject

Returns the value of attribute website.



10
11
12
# File 'lib/great_schools/district.rb', line 10

def website
  @website
end

Class Method Details

.browse(state, city) ⇒ Object

Returns a list of school districts in a city.

Attributes

  • state - Two letter state abbreviation

  • city - Name of city



22
23
24
25
26
# File 'lib/great_schools/district.rb', line 22

def browse(state, city)
  response = GreatSchools::API.get("districts/#{state.upcase}/#{parameterize(city)}")

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