Class: PPE_API::IucnCategory

Inherits:
Object
  • Object
show all
Includes:
HappyMapper
Defined in:
lib/ppe_api/iucn_category.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get_by_name(name) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/ppe_api/iucn_category.rb', line 12

def self.get_by_name(name)
  res, data = Config.http.get("/api/iucn_category/name/#{name}")
  res.value
  return self.parse(data) unless data.nil? || data.empty?
  return nil
  
end

Instance Method Details

#==(iucn) ⇒ Object



20
21
22
23
# File 'lib/ppe_api/iucn_category.rb', line 20

def ==(iucn)
  return false if iucn.nil?
  iucn.name==self.name
end

#to_xml(options = {}) ⇒ Object



25
26
27
# File 'lib/ppe_api/iucn_category.rb', line 25

def to_xml(options={})
  self.as_json.to_xml({:root => "iucn-category"}.merge(options))
end