Sha256: a58210b56eeb074aaeed3085cf9c1dac3ccf193ead504639aea338586443ebb5

Contents?: true

Size: 1.55 KB

Versions: 3

Compression:

Stored size: 1.55 KB

Contents

# XML mapping classes for OA query results
# relating to representatives

require 'xml/mapping'

module OpenAustralia

# office held by a representative
class RepresentativeOffice
  include XML::Mapping

  text_node :department, 'dept'
  text_node :position, 'position'
  text_node :from_date, 'from_date'
  text_node :to_date, 'to_date'
  text_node :person, 'person'
  text_node :source, 'source'
end

# record for an individual representative
class Representative
  include XML::Mapping

  numeric_node :member_id, 'member_id'
  numeric_node :person_id, 'person_id'
  text_node :constituency, 'constituency'
  text_node :party, 'party'
  numeric_node :house, 'house', :default_value => nil
  text_node :first_name, 'first_name', :default_value => nil
  text_node :last_name, 'last_name', :default_value => nil
  text_node :entered_house, 'entered_house', :default_value => nil
  text_node :entered_reason, 'entered_reason', :default_value => nil
  text_node :left_house, 'left_house', :default_value => nil
  text_node :left_reason, 'left_reason', :default_value => nil
  text_node :title, 'title', :default_value => nil
  text_node :full_name, 'full_name', :default_value => nil
  text_node :name, 'name', :default_value => nil
  text_node :image_url, 'image', :default_value => nil
  array_node :offices, "office", "match", :class=>RepresentativeOffice,
    :default_value =>[]
end

# record for foresults of a representative search
class RepresentativeResult
  include XML::Mapping

  array_node :matches, "result", "match", :class=>Representative,
    :default_value=>[]
end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
openaustralia-1.0.2 lib/openaustralia/representatives.rb
openaustralia-1.0.1 lib/openaustralia/representatives.rb
openaustralia-1.0.0 lib/openaustralia/representatives.rb