Class: Rews::Item::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/rews/item.rb

Overview

represents an Item from a mailbox on an Exchange server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, item_class, attributes) ⇒ Item

Returns a new instance of Item.



31
32
33
34
35
36
# File 'lib/rews/item.rb', line 31

def initialize(client, item_class, attributes)
  @client = client
  @item_id = ItemId.new(client, attributes[:item_id])
  @item_class = item_class
  @attributes = attributes || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



29
30
31
# File 'lib/rews/item.rb', line 29

def attributes
  @attributes
end

#clientObject (readonly)

Returns the value of attribute client.



26
27
28
# File 'lib/rews/item.rb', line 26

def client
  @client
end

#item_classObject (readonly)

Returns the value of attribute item_class.



28
29
30
# File 'lib/rews/item.rb', line 28

def item_class
  @item_class
end

#item_idObject (readonly)

Returns the value of attribute item_id.



27
28
29
# File 'lib/rews/item.rb', line 27

def item_id
  @item_id
end

Instance Method Details

#==(other) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/rews/item.rb', line 38

def ==(other)
  other.is_a?(Item) &&
    @client == other.client &&
    @item_id == other.item_id &&
    @item_class == other.item_class &&
    @attributes == other.attributes
end

#[](key) ⇒ Object

access the Item attributes



47
48
49
# File 'lib/rews/item.rb', line 47

def [](key)
  @attributes[key]
end

#inspectObject



56
57
58
# File 'lib/rews/item.rb', line 56

def inspect
  "#<#{self.class} @item_class=#{@item_class}, @item_id=#{@folder_id.inspect}, @attributes=#{@attributes.inspect}>"
end

#keysObject

names of the Item attributes



52
53
54
# File 'lib/rews/item.rb', line 52

def keys
  @attributes.keys
end