Sha256: 264ed15cf23859370e149c8166c2b7c96e794c7463b47378e689fd7e6286c18a

Contents?: true

Size: 1.29 KB

Versions: 17

Compression:

Stored size: 1.29 KB

Contents

module Rews
  # models IndexedPageItemView and IndexedPageFolderView definitions used by
  # <tt>Folder::BaseFolderId.find_*</tt> methods
  module View
    module Xml
      module_function

      def write_item_view(view_type, attrs, &proc)
        xml = Builder::XmlMarkup.new
        xml.wsdl view_type, Util::camel_keys(attrs) do
          proc.call(xml) if proc
        end
        xml.target!
      end
    end

    class Base
      include Util
      
      attr_reader :view

      def inspect
        "#<#{self.class} @view=#{@view.inspect}>"
      end
    end

    INDEXED_PAGE_VIEW_OPTS = {:max_entries_returned=>nil, :offset=>0, :base_point=>:Beginning}

    # models the IndexedPageItemView used in <tt>Folder::BaseFolderId.find_item</tt> method
    class IndexedPageItemView < Base
      def initialize(view)
        @view = check_opts(INDEXED_PAGE_VIEW_OPTS, view)
      end

      def to_xml
        Xml::write_item_view(:IndexedPageItemView, view)
      end
    end

    # models the IndexedPageFolderView used in <tt>Folder::BaseFolderId.find_folder</tt> methods
    class IndexedPageFolderView < Base
      def initialize(view)
        @view = check_opts(INDEXED_PAGE_VIEW_OPTS, view)
      end

      def to_xml
        Xml::write_item_view(:IndexedPageFolderView, view)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rews-0.5.5 lib/rews/view.rb
rews-0.5.4 lib/rews/view.rb
rews-0.5.3 lib/rews/view.rb
rews-0.5.1 lib/rews/view.rb
rews-0.5.0 lib/rews/view.rb
rews-0.2.12 lib/rews/view.rb
rews-0.2.11 lib/rews/view.rb
rews-0.2.10 lib/rews/view.rb
rews-0.2.9 lib/rews/view.rb
rews-0.2.7 lib/rews/view.rb
rews-0.2.6 lib/rews/view.rb
rews-0.2.5 lib/rews/view.rb
rews-0.2.4 lib/rews/view.rb
rews-0.2.3 lib/rews/view.rb
rews-0.2.2 lib/rews/view.rb
rews-0.2.1 lib/rews/view.rb
rews-0.2.0 lib/rews/view.rb