Class: GreatSchools::Model

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

Overview

GreatSchools Base Model

Direct Known Subclasses

Census, City, District, Ethnicity, Rank, Result, Review, School, Score, Test

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Model

Base initializer, map camelCased XML attributes from the GreatSchools API response to the appropriately underscored attribute setters.



24
25
26
27
28
29
# File 'lib/great_schools/model.rb', line 24

def initialize(attributes = {})
  attributes.each do |key, value|
    key = underscore(key)
    send("#{key}=", value) if respond_to?("#{key}=")
  end
end