Class: Viewpoint::EWS::SOAP::EwsResponse

Inherits:
Object
  • Object
show all
Includes:
StringUtils
Defined in:
lib/ews/soap/ews_response.rb

Overview

A Generic Class for SOAP returns.

Constant Summary

Constants included from StringUtils

StringUtils::DURATION_RE

Instance Method Summary collapse

Methods included from StringUtils

included

Constructor Details

#initialize(sax_hash) ⇒ EwsResponse



25
26
27
28
# File 'lib/ews/soap/ews_response.rb', line 25

def initialize(sax_hash)
  @resp = sax_hash
  simplify!
end

Instance Method Details

#bodyObject



38
39
40
# File 'lib/ews/soap/ews_response.rb', line 38

def body
  envelope[1][:body][:elems]
end

#envelopeObject



30
31
32
# File 'lib/ews/soap/ews_response.rb', line 30

def envelope
  @resp[:envelope][:elems]
end

#headerObject



34
35
36
# File 'lib/ews/soap/ews_response.rb', line 34

def header
  envelope[0][:header][:elems]
end

#responseObject



42
43
44
# File 'lib/ews/soap/ews_response.rb', line 42

def response
  body[0]
end

#response_messagesObject



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/ews/soap/ews_response.rb', line 46

def response_messages
  return @response_messages if @response_messages

  @response_messages = []
  response_type = response.keys.first
  response[response_type][:elems][0][:response_messages][:elems].each do |rm|
    response_message_type = rm.keys[0]
    rm_klass = class_by_name(response_message_type)
    @response_messages << rm_klass.new(rm)
  end
  @response_messages
end