Class: Viewpoint::EWS::Connection
- Inherits:
-
Object
- Object
- Viewpoint::EWS::Connection
- Includes:
- Viewpoint::EWS, ConnectionHelper
- Defined in:
- lib/ews/connection.rb
Constant Summary
Constants included from Viewpoint::EWS
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
Attributes included from Viewpoint::EWS
Instance Method Summary collapse
-
#authenticate ⇒ Boolean
Authenticate to the web service.
-
#dispatch(ews, soapmsg, opts) ⇒ Object
Every Connection class must have the dispatch method.
-
#get ⇒ String
Send a GET to the web service.
-
#initialize(endpoint, opts = {}) ⇒ Connection
constructor
A new instance of Connection.
-
#post(xmldoc) ⇒ String
Send a POST to the web service.
- #set_auth(user, pass) ⇒ Object
Methods included from Viewpoint::EWS
#remove_impersonation, root_logger, #set_impersonation
Methods included from ConnectionHelper
Constructor Details
#initialize(endpoint, opts = {}) ⇒ Connection
Returns a new instance of Connection.
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
24 25 26 |
# File 'lib/ews/connection.rb', line 24 def endpoint @endpoint end |
Instance Method Details
#authenticate ⇒ Boolean
Authenticate to the web service. You don't have to do this because authentication will happen on the first request if you don't do it here.
66 67 68 |
# File 'lib/ews/connection.rb', line 66 def authenticate self.get && true end |
#dispatch(ews, soapmsg, opts) ⇒ Object
Every Connection class must have the dispatch method. It is what sends the SOAP request to the server and calls the parser method on the EWS instance.
This was originally in the ExchangeWebService class but it was added here to make the processing chain easier to modify. For example, it allows the reactor pattern to handle the request with a callback.
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/ews/connection.rb', line 80 def dispatch(ews, soapmsg, opts) respmsg = post(soapmsg) @log.debug <<-EOF.gsub(/^ {6}/, '') Received SOAP Response: ---------------- #{Nokogiri::XML(respmsg).to_xml} ---------------- EOF opts[:raw_response] ? respmsg : ews.parse_soap_response(respmsg, opts) end |
#get ⇒ String
Send a GET to the web service
94 95 96 |
# File 'lib/ews/connection.rb', line 94 def get check_response( @httpcli.get(@endpoint) ) end |
#post(xmldoc) ⇒ String
Send a POST to the web service
101 102 103 104 |
# File 'lib/ews/connection.rb', line 101 def post(xmldoc) headers = {'Content-Type' => 'text/xml'} check_response( @httpcli.post(@endpoint, xmldoc, headers) ) end |
#set_auth(user, pass) ⇒ Object
59 60 61 |
# File 'lib/ews/connection.rb', line 59 def set_auth(user,pass) @httpcli.set_auth(@endpoint.to_s, user, pass) end |