Class: Net::DAV::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/net/dav/item.rb

Overview

Hold items found using Net::DAV#find

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Item) initialize(dav, uri, type, size)

:nodoc:



19
20
21
22
23
24
# File 'lib/net/dav/item.rb', line 19

def initialize(dav, uri, type, size) #:nodoc:
  @uri = uri
  @size = size.to_i rescue nil
  @type = type
  @dav = dav
end

Instance Attribute Details

- (Object) size (readonly)

Size of item if a file



9
10
11
# File 'lib/net/dav/item.rb', line 9

def size
  @size
end

- (Object) type (readonly)

Type of item - :directory or :file



12
13
14
# File 'lib/net/dav/item.rb', line 12

def type
  @type
end

- (Object) uri (readonly)

URI of item



6
7
8
# File 'lib/net/dav/item.rb', line 6

def uri
  @uri
end

Instance Method Details

- (Object) content

Get content from server if needed and return as string



27
28
29
30
# File 'lib/net/dav/item.rb', line 27

def content
  return @content unless @content.nil?
  @content = @dav.get(@uri.path)
end

- (Object) content=(str)

Put content to server



33
34
35
36
# File 'lib/net/dav/item.rb', line 33

def content=(str)
  @dav.put_string(@uri.path, str)
  @content = str
end

- (Object) inspect

:nodoc:



52
53
54
# File 'lib/net/dav/item.rb', line 52

def inspect #:nodoc:
  "#<Net::DAV::Item URL:#{@uri.to_s} type:#{@type}>"
end

- (Object) propfind

Properties for this item



44
45
46
# File 'lib/net/dav/item.rb', line 44

def propfind
  return @dav.propfind(@uri.path)
end

- (Object) proppatch(xml_snippet)

Proppatch item



39
40
41
# File 'lib/net/dav/item.rb', line 39

def proppatch(xml_snippet)
  @dav.proppatch(@uri.path,xml_snippet)
end

- (Object) to_s

:nodoc:



48
49
50
# File 'lib/net/dav/item.rb', line 48

def to_s #:nodoc:
  "#<Net::DAV::Item URL:#{@uri.to_s} type:#{@type}>"
end

- (Object) url

Synonym for uri



15
16
17
# File 'lib/net/dav/item.rb', line 15

def url
  @uri
end