Sha256: 6b1431a8a3ed3e925e85d74a16bf6720f1b07f7b626bcb35f59dc20308642feb

Contents?: true

Size: 962 Bytes

Versions: 6

Compression:

Stored size: 962 Bytes

Contents

# Extend Net::DAV::Item

module Net
  class DAV
    class Item

      def property(xpath)
        namespaces = {'v' => "vrtx",'d' => "DAV:"}
        xml = propfind
        res = xml.xpath(xpath, namespaces)
        if(res != nil)then
          if(res.size > 0)then
            return res.first.inner_text
          else
            return res.inner_text
          end
        end
        return nil
      end

      def method_missing(method, *args, &block)
        result = property('.//v:' + method.to_s)
        if(result != nil or result != "")then
          return result
        end

        result = property('.//d:' + method.to_s)
        if(result != nil or result != "")then
          return result
        end

        result = property('.//' + method.to_s)
        if(result != nil or result != "")then
          return result
        end

        raise "Method missing: Net::DAV::Item." + method.to_s
        return nil
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vortex_client-0.7.3 lib/vortex_client/item_extensions.rb
vortex_client-0.7.2 lib/vortex_client/item_extensions.rb
vortex_client-0.7.0 lib/vortex_client/item_extensions.rb
vortex_client-0.6.0 lib/vortex_client/item_extensions.rb
vortex_client-0.5.9 lib/vortex_client/item_extensions.rb
vortex_client-0.5.8 lib/vortex_client/item_extensions.rb