Class: RExchange::Message

Inherits:
GenericItem show all
Defined in:
lib/rexchange/message.rb

Instance Attribute Summary

Attributes inherited from GenericItem

#attributes

Instance Method Summary collapse

Methods inherited from GenericItem

attribute_mappings, find, inherited, #initialize, set_content_class, set_folder_type

Constructor Details

This class inherits a constructor from RExchange::GenericItem

Instance Method Details

#move_to(folder) ⇒ Object

Move this message to the specified folder. The folder can be a string such as ‘inbox/archive’ or a RExchange::Folder.

Example

mailbox.inbox.each do |message|
  message.move_to mailbox.inbox.archive
end


24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rexchange/message.rb', line 24

def move_to(folder)
  source = URI.parse(self.href).path
  destination = if folder.is_a?(RExchange::Folder)
    folder.to_s.ensure_ends_with('/') + source.split('/').last
  else
    @session.uri.path.ensure_ends_with('/') + folder.to_s.ensure_ends_with('/') + source.split('/').last
  end

  # $log.debug "move_to: source => \"#{source}\", destination => \"#{destination}\""
  DavMoveRequest.execute(@session, source, destination)
end

#to_sObject



37
38
39
# File 'lib/rexchange/message.rb', line 37

def to_s
  "To: #{to}, From: #{from}, Subject: #{subject}"
end