class DefraRuby::Area::Area
Attributes
area_id[R]
area_name[R]
code[R]
long_name[R]
short_name[R]
Public Class Methods
new(wfs_xml_element)
click to toggle source
# File lib/defra_ruby/area/area.rb, line 10 def initialize(wfs_xml_element) @xml = wfs_xml_element validate_xml parse_xml end
Private Instance Methods
parse_xml()
click to toggle source
# File lib/defra_ruby/area/area.rb, line 23 def parse_xml @area_id = @xml.xpath("ms:area_id").text.to_i @area_name = @xml.xpath("ms:area_name").text @code = @xml.xpath("ms:code").text @long_name = @xml.xpath("ms:long_name").text @short_name = @xml.xpath("ms:short_name").text end
validate_xml()
click to toggle source
# File lib/defra_ruby/area/area.rb, line 19 def validate_xml raise(ArgumentError, "wfs_xml_element is invalid") unless @xml.is_a?(Nokogiri::XML::Element) end