Class: MDEXClient::MData::Sort

Inherits:
Node
  • Object
show all
Defined in:
lib/mdex_client/mdata/sort.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#element

Instance Method Summary collapse

Methods inherited from Node

#css, #dimension_value_state_list, #initialize, #property_list, #record_list, #xpath

Constructor Details

This class inherits a constructor from MDEXClient::MData::Node

Instance Attribute Details

#directionObject

Returns the value of attribute direction.



6
7
8
# File 'lib/mdex_client/mdata/sort.rb', line 6

def direction
  @direction
end

#keyObject

Returns the value of attribute key.



6
7
8
# File 'lib/mdex_client/mdata/sort.rb', line 6

def key
  @key
end

#reference_geocodeObject

Returns the value of attribute reference_geocode.



6
7
8
# File 'lib/mdex_client/mdata/sort.rb', line 6

def reference_geocode
  @reference_geocode
end

Instance Method Details

#initialize_from_element!Object



8
9
10
11
12
13
14
# File 'lib/mdex_client/mdata/sort.rb', line 8

def initialize_from_element!
  @key = element["Key"]
  @direction = element["Direction"]
  
  rgc = element.xpath("mdata:ReferenceGeocode").first
  @reference_geocode = Geocode.new(rgc) if rgc
end

#write_xml!(xml) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/mdex_client/mdata/sort.rb', line 16

def write_xml!(xml)
  xml.mdata :Sort, "Key" => key, "Direction" => direction do |xml|
    if reference_geocode
      xml.mdata :ReferenceGeocode, "Latitude" => reference_geocode.latitude,
        "Longitude" => reference_geocode.longitude
    end
  end
end