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



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

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

Instance Method Details

#geometry_jsonObject



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

def geometry_json
  JSON.parse(@the_geom)
end

#to_xml(options = {}) ⇒ Object



24
25
26
# File 'lib/ppe_api/country.rb', line 24

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