Skip to content

Instantly share code, notes, and snippets.

@MarkMenard
Created May 22, 2010 20:29
Show Gist options
  • Save MarkMenard/410341 to your computer and use it in GitHub Desktop.
Save MarkMenard/410341 to your computer and use it in GitHub Desktop.
class HapagLloydMoveDocWrapper < DocWrapperBase
property :carrier_description, :string, './td[1]'
property :location, :string, './td[2]'
multi_property :time_of_move, ['./td[3]','./td[4]'] do |x|
Time.parse("#{x[0]} #{x[1]}".strip)
end
property :status, :raw, './td[1]' do |node_list|
node = node_list.first
if node.attribute("class") && node.attribute("class").content =~ /strong/
'ACTUAL'
else
'PROJECTED'
end
end
property :vessel, :string, './td[5]'
property :voyage, :string, './td[6]'
end
class HapagLloydContainerDocWrapper < DocWrapperBase
property :number, :string, "//input[@id='tracing_by_booking_f:hl12']/@value", :document => 1 do |x|
x.gsub(/ /,'')
end
#TODO Ask is :start_row first row should be 0 or 1
has_many :moves, "//table[@id='tracing_by_booking_f:hl55']/tbody/tr", HapagLloydMoveDocWrapper, :document => 1, :start_row => 0
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment