Class: Zimbra::FolderService::Parser

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

Direct Known Subclasses

CalendarService::Parser

Constant Summary collapse

ATTRIBUTE_MAPPING =
{
  :id => :id, 
  :uuid => :uuid, 
  :name => :name, 
  :view => :view, 
  :absFolderPath => :absolute_folder_path, 
  :l => :parent_folder_id, 
  :luuid => :parent_folder_uuid, 
  :n => :non_folder_item_count, 
  :s => :non_folder_item_size, 
  :rev => :revision, 
  :i4next => :imap_next_uid, 
  :i4ms => :imap_modified_sequence, 
  :ms => :modified_sequence, 
  :activesyncdisabled => :activesync_disabled, 
  :md => :modified_date
}

Class Method Summary collapse

Class Method Details

.folder_response(node) ⇒ Object



86
87
88
89
90
91
92
# File 'lib/zimbra/folder.rb', line 86

def folder_response(node)
  folder_attributes = ATTRIBUTE_MAPPING.inject({}) do |attrs, (xml_name, attr_name)|
    attrs[attr_name] = (node/"@#{xml_name}").to_s
    attrs
  end
  initialize_from_attributes(folder_attributes)
end

.get_all_response(response) ⇒ Object



80
81
82
83
84
# File 'lib/zimbra/folder.rb', line 80

def get_all_response(response)
  (response/"//n2:folder").map do |node|
    folder_response(node)
  end
end

.initialize_from_attributes(folder_attributes) ⇒ Object



94
95
96
# File 'lib/zimbra/folder.rb', line 94

def initialize_from_attributes(folder_attributes)
  Zimbra::Folder.new(folder_attributes)
end