Class: PPE_API::Country

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get_by_iso(iso) ⇒ Object



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

def self.get_by_iso(iso)
  res, data = Config.http.get("/api/country/iso/#{iso}")
  res.value
  Country.parse(data) unless data.nil? || data.empty?
end

Instance Method Details

#geometry_jsonObject



16
17
18
# File 'lib/ppe_api/country.rb', line 16

def geometry_json
  JSON.parse(@the_geom)
end

#to_xml(options = {}) ⇒ Object



26
27
28
# File 'lib/ppe_api/country.rb', line 26

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