Class: Rews::Folder::VanillaFolderId

Inherits:
BaseFolderId show all
Defined in:
lib/rews/folder.rb

Overview

identifies a regular (non-distinguished) Folder on an Exchange server

Constant Summary

Constants inherited from BaseFolderId

BaseFolderId::FIND_FOLDER_OPTS, BaseFolderId::FIND_ITEM_OPTS

Instance Attribute Summary collapse

Attributes inherited from BaseFolderId

#client

Instance Method Summary collapse

Methods inherited from BaseFolderId

#find_folder, #find_folder_id, #find_item, #find_item_id

Methods included from Util

apply_namespace, camel_keys, camelize, camelize_qname, check_opts, rsxml_to_xml, single_error_check, strip_bang, tag_exception, with_error_check

Constructor Details

#initialize(client, folder_id) ⇒ VanillaFolderId

Returns a new instance of VanillaFolderId.



203
204
205
206
207
208
# File 'lib/rews/folder.rb', line 203

def initialize(client, folder_id)
  super(client)
  @id=folder_id[:id]
  @change_key=folder_id[:change_key]
  raise "no id" if !@id
end

Instance Attribute Details

#change_keyObject (readonly)

change_key identifies a specific version of the Folder



201
202
203
# File 'lib/rews/folder.rb', line 201

def change_key
  @change_key
end

#idObject (readonly)

the Id of the Folder



198
199
200
# File 'lib/rews/folder.rb', line 198

def id
  @id
end

Instance Method Details

#==(other) ⇒ Object



210
211
212
213
214
215
# File 'lib/rews/folder.rb', line 210

def ==(other)
  other.is_a?(VanillaFolderId) &&
    @client == other.client &&
    @id == other.id &&
    @change_key == other.change_key
end

#inspectObject



232
233
234
# File 'lib/rews/folder.rb', line 232

def inspect
  "#<#{self.class} @id=#{id}, @change_key=#{change_key}>"
end

#key(ignore_change_key = false) ⇒ Object

a JSON compatible key for persistently identifying this folder



218
219
220
221
222
# File 'lib/rews/folder.rb', line 218

def key(ignore_change_key=false)
  key = ["folder", id]
  key << change_key if !ignore_change_key
  key
end

#to_xmlObject



224
225
226
227
228
229
230
# File 'lib/rews/folder.rb', line 224

def to_xml
  xml = Builder::XmlMarkup.new
  attrs = {:Id=>id.to_s}
  attrs[:ChangeKey] = change_key.to_s if change_key
  xml.t :FolderId, attrs
  xml.target!
end