Class: EWS::Parser
- Inherits:
-
Object
- Object
- EWS::Parser
- Defined in:
- lib/ews/parser.rb
Instance Method Summary collapse
- #parse_find_folder(doc) ⇒ Object
- #parse_find_item(doc) ⇒ Object
- #parse_get_attachment(doc) ⇒ Object
- #parse_get_folder(doc) ⇒ Object
- #parse_get_item(doc) ⇒ Object
- #parse_resolve_names(doc) ⇒ Object
-
#parse_response_message(doc) ⇒ Object
Checks the ResponseMessage for errors.
Instance Method Details
#parse_find_folder(doc) ⇒ Object
8 9 10 11 12 |
# File 'lib/ews/parser.rb', line 8 def parse_find_folder(doc) doc.xpath('//t:Folders/child::*').map do |node| parse_exchange_folder node.xpath('.') # force NodeSelection end.compact end |
#parse_find_item(doc) ⇒ Object
18 19 20 21 22 |
# File 'lib/ews/parser.rb', line 18 def parse_find_item(doc) doc.xpath('//t:Items/child::*').map do |node| parse_exchange_item node.xpath('.') # force NodeSelection end.compact end |
#parse_get_attachment(doc) ⇒ Object
28 29 30 |
# File 'lib/ews/parser.rb', line 28 def (doc) doc.xpath('//m:Attachments/child::*[1]') end |
#parse_get_folder(doc) ⇒ Object
14 15 16 |
# File 'lib/ews/parser.rb', line 14 def parse_get_folder(doc) parse_exchange_folder doc.xpath('//m:Folders/child::*[1]') end |
#parse_get_item(doc) ⇒ Object
24 25 26 |
# File 'lib/ews/parser.rb', line 24 def parse_get_item(doc) parse_exchange_item doc.xpath('//m:Items/child::*[1]') end |
#parse_resolve_names(doc) ⇒ Object
4 5 6 |
# File 'lib/ews/parser.rb', line 4 def parse_resolve_names(doc) raise 'TODO' end |
#parse_response_message(doc) ⇒ Object
Checks the ResponseMessage for errors.
Exhange 2007 Valid Response Messages
36 37 38 39 40 41 42 43 |
# File 'lib/ews/parser.rb', line 36 def (doc) error_node = doc.xpath('//m:ResponseMessages/child::*[@ResponseClass="Error"]') unless error_node.empty? error_msg = error_node.xpath('m:MessageText/text()').to_s response_code = error_node.xpath('m:ResponseCode/text()').to_s raise EWS::ResponseError.new(error_msg, response_code) end end |