Module: Plaza::BaseModel::ClassMethods

Defined in:
lib/plaza/models/base_model.rb

Instance Method Summary collapse

Instance Method Details

#adapterObject



18
19
20
# File 'lib/plaza/models/base_model.rb', line 18

def adapter
  Plaza.adapter(self)
end

#collection(response) ⇒ Object

assumes a shallow hierarchy where there is only one root element that contains an array of hashes For Example: :rank=>“0.4”, :rank=>“0.9”]}



12
13
14
15
16
# File 'lib/plaza/models/base_model.rb', line 12

def collection(response)
  response.values.first.collect do |obj|
    self.new(obj)
  end
end