Class: Gaah::ApiModel

Inherits:
Object
  • Object
show all
Defined in:
lib/gaah/api_model.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/gaah/api_model.rb', line 3

def id
  @id
end

Class Method Details

.batch_create(xml) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/gaah/api_model.rb', line 5

def self.batch_create(xml)
  if xml.is_a? Array
    xml.map do |item|
      begin
        self.new(item)
      rescue
        raise ApiParsingException.new(item)
      end
    end
  else
    (xml/:entry).map(&method(:new))
  end
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
# File 'lib/gaah/api_model.rb', line 19

def ==(other)
  @id == other.id
end