viewpoint 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -136,10 +136,10 @@ module Viewpoint
136
136
  node.add("#{NS_EWS_MESSAGES}:FolderShape") do |fshape|
137
137
  fshape.add("#{NS_EWS_TYPES}:BaseShape", folder_shape[:base_shape])
138
138
 
139
- unless( folder_shape[:additional_props].nil? )
140
- unless( folder_shape[:additional_props][:FieldURI].nil? )
139
+ unless( folder_shape[:additional_properties].nil? )
140
+ unless( folder_shape[:additional_properties][:FieldURI].nil? )
141
141
  fshape.add("#{NS_EWS_TYPES}:AdditionalProperties") do |addprops|
142
- folder_shape[:additional_props][:FieldURI].each do |uri|
142
+ folder_shape[:additional_properties][:FieldURI].each do |uri|
143
143
  addprops.add("#{NS_EWS_TYPES}:FieldURI") { |furi| furi.set_attr('FieldURI', uri) }
144
144
  end
145
145
  end
@@ -156,9 +156,15 @@ module Viewpoint
156
156
  is.add("#{NS_EWS_TYPES}:BodyType", item_shape[:body_type]) if item_shape.has_key?(:body_type)
157
157
  is.add("#{NS_EWS_TYPES}:FilterHtmlContent", item_shape[:filter_html_content]) if item_shape.has_key?(:filter_html_content)
158
158
  is.add("#{NS_EWS_TYPES}:ConvertHtmlCodePageToUTF8", item_shape[:convert_html_code_page_to_utf8]) if item_shape.has_key?(:convert_html_code_page_to_utf8)
159
- end
160
-
161
- unless( item_shape[:additional_props].nil? )
159
+ unless( item_shape[:additional_properties].nil? )
160
+ unless( item_shape[:additional_properties][:field_uRI].nil? )
161
+ is.add("#{NS_EWS_TYPES}:AdditionalProperties") do |addprops|
162
+ item_shape[:additional_properties][:field_uRI].each do |uri|
163
+ addprops.add("#{NS_EWS_TYPES}:FieldURI") { |furi| furi.set_attr('FieldURI', uri) }
164
+ end
165
+ end
166
+ end
167
+ end
162
168
  end
163
169
  end
164
170
 
@@ -338,23 +344,32 @@ module Viewpoint
338
344
 
339
345
  # Add a hierarchy of elements from hash data
340
346
  # @example Hash to XML
341
- # {:this => {:text =>'that'},'top' => {:id => '32fss', :text => 'TestText', {'middle' => 'bottom'}}}
347
+ # {:this => {:text =>'that'},'top' => {:id => '32fss', :text => 'TestText', :sub_elements => {'middle' => {:text => 'bottom'}}}}
342
348
  # becomes...
343
349
  # <this>that</this>
344
350
  # <top Id='32fss'>
345
- # TestText
346
351
  # <middle>bottom</middle>
347
352
  # </top>
348
353
  def add_hierarchy!(node, e_hash, prefix = NS_EWS_TYPES)
349
354
  e_hash.each_pair do |k,v|
350
355
  if v.is_a? Hash
351
- node.add("#{prefix}:#{k.to_s.camel_case}", v[:text]) do |n|
352
- add_hierarchy!(n, v)
356
+ if(k == :sub_elements)
357
+ add_hierarchy!(node, v)
358
+ else
359
+ node.add("#{prefix}:#{k.to_s.camel_case}", v[:text]) do |n|
360
+ add_hierarchy!(n, v)
361
+ end
353
362
  end
354
363
  elsif v.is_a? Array
355
- node.add("#{prefix}:#{k.to_s.camel_case}") do |n|
364
+ if(k == :sub_elements)
356
365
  v.each do |i|
357
- add_hierarchy!(n, i)
366
+ add_hierarchy!(node, i)
367
+ end
368
+ else
369
+ node.add("#{prefix}:#{k.to_s.camel_case}") do |n|
370
+ v.each do |i|
371
+ add_hierarchy!(n, i)
372
+ end
358
373
  end
359
374
  end
360
375
  else
@@ -83,9 +83,16 @@ module Viewpoint
83
83
  end
84
84
 
85
85
  def on_after_create_http_request(req)
86
- req.set_auth @@user, @@pass
86
+ begin
87
+ req.set_auth @@user, @@pass
88
+ rescue NameError => e
89
+ raise EwsLoginError, "Please remember to set your credential information."
90
+ end
87
91
  end
88
92
 
93
+ def on_http_error(response)
94
+ raise EwsLoginError, "Failed to login to EWS at #{uri}. Please check your credentials." if(response.status == 401)
95
+ end
89
96
 
90
97
  # ********** End Hooks **********
91
98
 
@@ -764,7 +771,11 @@ module Viewpoint
764
771
 
765
772
  # Override the superclasses' invoke so we can add http_options to each request
766
773
  def invoke(msg, action)
767
- super(msg, {:soap_action => action, :http_options => @@http_options})
774
+ begin
775
+ super(msg, {:soap_action => action, :http_options => @@http_options})
776
+ rescue SocketError
777
+ raise EwsError, "Could not connect to endpoint: #{uri}"
778
+ end
768
779
  end
769
780
 
770
781
  end # class ExchangeWebService
@@ -48,6 +48,10 @@ require 'model/message'
48
48
  require 'model/calendar_item'
49
49
  require 'model/contact'
50
50
  require 'model/distribution_list'
51
+ require 'model/meeting_message'
52
+ require 'model/meeting_request'
53
+ require 'model/meeting_response'
54
+ require 'model/meeting_cancellation'
51
55
  require 'model/task'
52
56
  require 'model/attachment'
53
57
  require 'model/file_attachment'
@@ -27,7 +27,7 @@ describe "Folder Synchronization" do
27
27
  end
28
28
 
29
29
  it 'should synchronized to a given DateTime' do
30
- @inbox.sync_items_since!((Date.today - 1).to_datetime)
30
+ @inbox.sync_items_since!(DateTime.parse((Date.today - 1).to_s))
31
31
  @inbox.sync_state.should_not be_nil
32
32
  end
33
33
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 8
9
- version: 0.1.8
8
+ - 9
9
+ version: 0.1.9
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-11-24 00:00:00 -06:00
17
+ date: 2010-11-28 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -131,6 +131,10 @@ files:
131
131
  - lib/model/item.rb
132
132
  - lib/model/item_attachment.rb
133
133
  - lib/model/mailbox_user.rb
134
+ - lib/model/meeting_cancellation.rb
135
+ - lib/model/meeting_message.rb
136
+ - lib/model/meeting_request.rb
137
+ - lib/model/meeting_response.rb
134
138
  - lib/model/message.rb
135
139
  - lib/model/model.rb
136
140
  - lib/model/search_folder.rb