viewpoint 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91,6 +91,25 @@ module Viewpoint
91
91
  super(ews_item)
92
92
  end
93
93
 
94
+ # Call UpdateItem for this item with the passed updates
95
+ # @param [Hash] updates a well-formed update hash
96
+ # @example {:set_item_field=>{:field_u_r_i=>{:field_u_r_i=>"message:IsRead"}, :message=>{:is_read=>{:text=>"true"}}}}
97
+ # TODO: This is a stand-in for the Item#update! method until I can firm it up a bit. It is neccessary for the SendMeetingInvitationsOrCancellations attrib
98
+ def update!(updates)
99
+ conn = Viewpoint::EWS::EWS.instance
100
+ resp = conn.ews.update_item([{:id => @item_id, :change_key => @change_key}], {:updates => updates},
101
+ {:message_disposition => 'SaveOnly', :conflict_resolution => 'AutoResolve', :send_meeting_invitations_or_cancellations => 'SendToNone'})
102
+ if resp.status == 'Success'
103
+ @item_id = resp.items.first[resp.items.first.keys.first][:item_id][:id]
104
+ @change_key = resp.items.first[resp.items.first.keys.first][:item_id][:change_key]
105
+ @shallow = true
106
+ deepen!
107
+ else
108
+ raise EwsError, "Trouble updating Item. #{resp.code}: #{resp.message}"
109
+ end
110
+
111
+ end
112
+
94
113
  # Delete this item
95
114
  # @param [Boolean] soft Whether or not to do a soft delete. By default EWS will do a
96
115
  # hard delete of this item. See the MSDN docs for more info:
data/lib/model/item.rb CHANGED
@@ -126,7 +126,7 @@ module Viewpoint
126
126
 
127
127
  updates.each_pair do |k,v|
128
128
  raise EwsError, "Field (#{FIELD_URIS[k][:text]}) not writable by update." unless FIELD_URIS[k][:writable]
129
- changes << {:set_item_field=>{:field_u_r_i=>{:field_u_r_i=>FIELD_URIS[k][:text]}, type=>{k => v}}}
129
+ changes << {:set_item_field=>[{:field_u_r_i => {:field_u_r_i=>FIELD_URIS[k][:text]}}, {type=>{k => v}}]}
130
130
  end
131
131
 
132
132
  update!(changes)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 11
9
- version: 0.1.11
8
+ - 12
9
+ version: 0.1.12
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dan Wanek
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-27 00:00:00 -06:00
17
+ date: 2010-12-29 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency