Class: XCAPClient::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/xcapclient/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, plain = nil, etag = nil, parsed = nil) ⇒ Document

Create a new instance. name, plain and etag are String.

Raises:



21
22
23
24
25
26
27
28
29
# File 'lib/xcapclient/document.rb', line 21

def initialize(name, plain=nil, etag=nil, parsed=nil)
	@name = name
	@plain = plain
	@parsed = parsed
	@etag = etag
	
	# Check name.
	raise ConfigError, "Document `name' must be a non empty string" unless String === @name && ! @name.empty?
end

Instance Attribute Details

#etagObject

The last received ETag value in a response from the server. It can be set manually.



12
13
14
# File 'lib/xcapclient/document.rb', line 12

def etag
  @etag
end

#last_responseObject

The last response received from the server. It’s a :Message object.



18
19
20
# File 'lib/xcapclient/document.rb', line 18

def last_response
  @last_response
end

#nameObject (readonly)

The name of the document as it exists in the server.



6
7
8
# File 'lib/xcapclient/document.rb', line 6

def name
  @name
end

#parsedObject

This attribute could contain the parsed instance of the XML document. It’s not required by XCAPClient itself, but could be useful for the program in top of it.



15
16
17
# File 'lib/xcapclient/document.rb', line 15

def parsed
  @parsed
end

#plainObject

Contains the plain document fetched from the server or manually set.



9
10
11
# File 'lib/xcapclient/document.rb', line 9

def plain
  @plain
end

Instance Method Details

#resetObject

Delete the local plain and parsed document and the ETag.



32
33
34
35
36
# File 'lib/xcapclient/document.rb', line 32

def reset
	@plain = nil
	@parsed = nil
	@etag = nil
end