Class: Petfinder::Shelter

Inherits:
Object
  • Object
show all
Extended by:
XmlMapper
Defined in:
lib/petfinder/shelter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from XmlMapper

camel_case_lower, xml_attribute, xml_attributes

Constructor Details

#initialize(xml) ⇒ Shelter

Returns a new instance of Shelter.



8
9
10
# File 'lib/petfinder/shelter.rb', line 8

def initialize(xml)
  @xml = xml
end

Class Method Details

.multiple(xml) ⇒ Object



16
17
18
19
20
# File 'lib/petfinder/shelter.rb', line 16

def self.multiple(xml)
  xml.xpath("//shelters/shelter").map do |node|
    Shelter.new(Nokogiri::XML(node.to_xml))
  end
end

Instance Method Details

#inspectObject



12
13
14
# File 'lib/petfinder/shelter.rb', line 12

def inspect
  "#<Shelter id: '#{id}', name: '#{name}', state: '#{state}'>"
end