Sha256: ce28bd0eacf4174baefca479d1c21faa040df7c1b6d0a332bf7ea2194cbb028f
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 KB
Contents
module Rews module Shape module Xml module_function def write_shape(shape_type, &proc) xml = Builder::XmlMarkup.new xml.wsdl shape_type do proc.call(xml) end xml.target! end def write_additional_properties(xml, additional_properties) return if !additional_properties xml.t :AdditionalProperties do additional_properties.each do |additional_property| if additional_property[0] == :field_uri xml.t :FieldURI, :FieldURI=>additional_property[1] end end end end end class Base include Util attr_reader :shape end ITEM_SHAPE_OPTS = { :base_shape=>:Default, :include_mime_content=>nil, :additional_properties=>nil } class ItemShape < Base def initialize(shape) @shape = check_opts(ITEM_SHAPE_OPTS, shape) end def to_xml Xml::write_shape(:ItemShape) do |xml| xml.t :BaseShape, shape[:base_shape] xml.t :IncludeMimeContent, shape[:include_mime_content] if shape[:include_mime_content] Xml::write_additional_properties(xml, shape[:additional_properties]) end end end FOLDER_SHAPE_OPTS = { :base_shape=>:Default, :additional_properties=>nil } class FolderShape < Base def initialize(shape) @shape = check_opts(FOLDER_SHAPE_OPTS, shape) end def to_xml Xml::write_shape(:FolderShape) do |xml| xml.t :BaseShape, shape[:base_shape] Xml::write_additional_properties(xml, shape[:additional_properties]) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rews-0.1.0 | lib/rews/shape.rb |