Class: Viewpoint::EWS::EWS

Inherits:
Object
  • Object
show all
Includes:
Singleton, Viewpoint
Defined in:
lib/viewpoint.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEWS

Returns a new instance of EWS.



122
123
124
# File 'lib/viewpoint.rb', line 122

def initialize
  @ews = SOAP::ExchangeWebService.new
end

Instance Attribute Details

#:ewsViewpoint::EWS::SOAP::ExchangeWebService (readonly)

The EWS object used to make SOAP calls. You typically don’t need to use this, but if you want to play around with the SOAP back-end it’s available.

Returns:



78
79
80
# File 'lib/viewpoint.rb', line 78

def :ews
  @:ews
end

#ewsObject (readonly)

Returns the value of attribute ews.



82
83
84
# File 'lib/viewpoint.rb', line 82

def ews
  @ews
end

Class Method Details

.endpointObject

Fetch the current endpoint



96
97
98
# File 'lib/viewpoint.rb', line 96

def self.endpoint
  @@endpoint
end

.endpoint=(endpoint, version = 1) ⇒ Object

Set the endpoint for Exchange Web Services.

Parameters:

  • endpoint (String)

    The URL of the endpoint. This should end in ‘exchange.asmx’ and is typically something like this: myexch/ews/exchange.asmx

  • version (Integer) (defaults to: 1)

    The SOAP version to use. This defaults to 1 and you should not need to pass this parameter.



90
91
92
93
# File 'lib/viewpoint.rb', line 90

def self.endpoint=(endpoint, version = 1)
  @@endpoint = endpoint
  SOAP::ExchangeWebService.endpoint(:uri => endpoint, :version => version) && true
end

.set_auth(user, pass) ⇒ Object

Set the SOAP username and password.

Parameters:

  • user (String)

    The user name

  • pass (String)

    The password



103
104
105
106
# File 'lib/viewpoint.rb', line 103

def self.set_auth(user,pass)
  @@user = user
  SOAP::ExchangeWebService.set_auth(user,pass) && true
end

.set_http_driver(driver) ⇒ Object

Set the http driver that the SOAP back-end will use.

Parameters:

  • driver (Symbol)

    The HTTP driver. Available drivers: :curb, :net_http, :http_client(Default)



111
112
113
# File 'lib/viewpoint.rb', line 111

def self.set_http_driver(driver)
  Handsoap.http_driver = driver
end

.set_trust_ca(ca_path) ⇒ Object

Sets the CA path to a certificate or hashed certificate directory. This is the same as HTTPClient::SSLConfig.set_trust_ca

Parameters:

  • ca_path (String)

    A path to an OpenSSL::X509::Certificate or a ‘c-rehash’ed directory



118
119
120
# File 'lib/viewpoint.rb', line 118

def self.set_trust_ca(ca_path)
  SOAP::ExchangeWebService.set_http_options(:trust_ca_file => ca_path) && true
end

Instance Method Details

#meObject

The MailboxUser object that represents the user connected to EWS.



127
128
129
# File 'lib/viewpoint.rb', line 127

def me
  MailboxUser.find_user((@@user.include?('@') ? @@user : "#{@@user}@"))
end