Class: Viewpoint::EWS::SOAP::EwsSoapResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/ews/soap/ews_soap_response.rb

Overview

A Generic Class for SOAP returns.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sax_hash) ⇒ EwsSoapResponse

Returns a new instance of EwsSoapResponse.



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

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

Instance Attribute Details

#:messageString (readonly)

The text from the EWS element <m:ResponseCode>

Returns:

  • (String)

    the current value of :message



23
24
25
# File 'lib/ews/soap/ews_soap_response.rb', line 23

def :message
  @:message
end

Instance Method Details

#bodyObject



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

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

#envelopeObject



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

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

#headerObject



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

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

#responseObject



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

def response
  body[0]
end

#response_classObject Also known as: status



56
57
58
# File 'lib/ews/soap/ews_soap_response.rb', line 56

def response_class
  response_message[:attribs][:response_class]
end

#response_codeObject Also known as: code



61
62
63
# File 'lib/ews/soap/ews_soap_response.rb', line 61

def response_code
  response_message[:elems][:response_code][:text]
end

#response_messageObject



51
52
53
54
# File 'lib/ews/soap/ews_soap_response.rb', line 51

def response_message
  key = response_messages[0].keys.first
  response_messages[0][key]
end

#response_message_textObject Also known as: message



66
67
68
# File 'lib/ews/soap/ews_soap_response.rb', line 66

def response_message_text
  guard_hash response_message[:elems], [:message_text, :text]
end

#response_messagesObject



46
47
48
49
# File 'lib/ews/soap/ews_soap_response.rb', line 46

def response_messages
  key = response.keys.first
  response[key][:elems].find{|e| e.keys.include? :response_messages }[:response_messages][:elems]
end

#success?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/ews/soap/ews_soap_response.rb', line 71

def success?
  response_class == "Success"
end