Class: Toodledo::Folder

Inherits:
Object
  • Object
show all
Defined in:
lib/toodledo/folder.rb

Overview

A read only representation of a Folder.

Constant Summary collapse

NO_FOLDER =
Folder.new(0, 1, 0, "No folder")

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, is_private, archived, name) ⇒ Folder

Returns a new instance of Folder.



8
9
10
11
12
13
# File 'lib/toodledo/folder.rb', line 8

def initialize(id, is_private, archived, name)
  @id = id
  @is_private = is_private
  @archived = archived
  @name = name
end

Instance Attribute Details

#archivedObject (readonly)

Returns the value of attribute archived.



17
18
19
# File 'lib/toodledo/folder.rb', line 17

def archived
  @archived
end

#is_privateObject (readonly)

Returns the value of attribute is_private.



17
18
19
# File 'lib/toodledo/folder.rb', line 17

def is_private
  @is_private
end

#nameObject (readonly)

Returns the value of attribute name.



17
18
19
# File 'lib/toodledo/folder.rb', line 17

def name
  @name
end

Class Method Details

.parse(session, el) ⇒ Object

Creates a session object from an XML element.



32
33
34
35
36
37
38
39
# File 'lib/toodledo/folder.rb', line 32

def self.parse(session, el)
  id = el.attributes['id']
  is_private = el.attributes['private']
  archived = el.attributes['archived']
  name = el.text
  folder = Folder.new(id, is_private, archived, name)
  return folder
end

Instance Method Details

#archived?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/toodledo/folder.rb', line 27

def archived?
  return @archived == 1
end

#is_private?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/toodledo/folder.rb', line 23

def is_private?
  return @is_private == 1
end

#server_idObject



19
20
21
# File 'lib/toodledo/folder.rb', line 19

def server_id
  return @id
end

#to_xmlObject



41
42
43
# File 'lib/toodledo/folder.rb', line 41

def to_xml()
  return "<folder id=\"#{@id}\" private=\"#{@is_private}\" archived=\"#{@archived}\">#{@name}</folder>"
end