Module: RGData::Model

Included in:
Profile
Defined in:
lib/rgdata/model.rb

Overview

A class that includes RGData::Model represent an XML response from GOogle as a Ruby object. The class method new_from_xml_hash accepts an XML hash. It should be the portion of the HTTParty/Crack parsed hash that represents a single record. Once the module is included, the class just needs to declare fields and define instructions on how to drill down into the hash to get to the useful information.

Defined Under Namespace

Modules: ClassMethods Classes: FieldError, Profile

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(target) ⇒ Object



9
10
11
# File 'lib/rgdata/model.rb', line 9

def self.included(target)
  target.extend ClassMethods
end

Instance Method Details

#initialize(atts = {}) ⇒ Object



43
44
45
46
47
# File 'lib/rgdata/model.rb', line 43

def initialize(atts = {})
  atts.each do |field, value|
    send "#{field}=", value
  end
end