Sha256: f0ef16989ebe21a78d9cade5e038cc1c9e9e6f136fde0d20281217cb0e68829b
Contents?: true
Size: 1.27 KB
Versions: 17
Compression:
Stored size: 1.27 KB
Contents
module Rews # models SortOrder used in <tt>Folder::BaseFolderId.find_*</tt> methods # # takes sort_orders written in Ruby s-expressions and # outputs EWS SortOrder XML e.g. # # <tt>[["item:DateTimeReceived", "Ascending"], ["item:Size", "Descending"]]</tt> class SortOrder attr_reader :expr def initialize(expr) @expr=expr end def inspect "#<#{self.class} @expr=#{@expr.inspect}>" end def to_xml Xml::write_sort_order(expr) end module Xml module_function def write_sort_order(expr) xml = Builder::XmlMarkup.new xml.wsdl :SortOrder do write_expr(xml, expr) end xml.target! end def write_expr(xml, expr) expr.each do |field_order| write_field_order(xml, field_order) end end def write_field_order(xml, field_order) if field_order.is_a?(Array) xml.t :FieldOrder, :Order=>field_order[1] do write_field_uri(xml, field_order[0]) end else xml.t :FieldOrder, field_order do write_field_uri(xml, field_order) end end end def write_field_uri(xml, field_uri) xml.t :FieldURI, :FieldURI=>field_uri end end end end
Version data entries
17 entries across 17 versions & 1 rubygems