Class: Viewpoint::EWSClient

Inherits:
Object
  • Object
show all
Includes:
EWS, Viewpoint::EWS::CalendarAccessors, Viewpoint::EWS::FolderAccessors, Viewpoint::EWS::ItemAccessors, Viewpoint::EWS::MailboxAccessors, Viewpoint::EWS::MessageAccessors, Viewpoint::EWS::PushSubscriptionAccessors
Defined in:
lib/ews/ews_client.rb

Overview

This class is the glue between the Models and the Web Service.

Constant Summary

Constant Summary

Constants included from Viewpoint::EWS::FolderAccessors

Viewpoint::EWS::FolderAccessors::FOLDER_TYPE_MAP

Instance Attribute Summary (collapse)

Attributes included from EWS

#logger

Instance Method Summary (collapse)

Methods included from Viewpoint::EWS::CalendarAccessors

#event_busy_type, #event_end_time, #event_start_time

Methods included from EWS

root_logger

Methods included from Viewpoint::EWS::PushSubscriptionAccessors

#parse_send_notification

Methods included from Viewpoint::EWS::MailboxAccessors

#get_user_availability, #search_contacts

Methods included from Viewpoint::EWS::MessageAccessors

#draft_message, #send_message

Methods included from Viewpoint::EWS::ItemAccessors

#copy_items, #find_items, #get_item, #move_items

Methods included from Viewpoint::EWS::FolderAccessors

#folders, #get_folder, #get_folder_by_name, #make_folder, #sync_folders

Constructor Details

- (EWSClient) initialize(endpoint, user = nil, pass = nil, opts = {})

Initialize the EWSClient instance.

Parameters:

  • endpoint (String)

    The EWS endpoint we will be connecting to

  • user (String) (defaults to: nil)

    The user to authenticate as. If you are using NTLM or Negotiate authentication you do not need to pass this parameter.

  • pass (String) (defaults to: nil)

    The user password. If you are using NTLM or Negotiate authentication you do not need to pass this parameter.

  • opts (Hash) (defaults to: {})

    Various options to pass to the backends

Options Hash (opts):

  • :server_version (String)

    The Exchange server version to target. See the VERSION_* constants in Viewpoint::EWS::SOAP::ExchangeWebService.

  • :http_class (Object)

    specify an alternate HTTP connection class.

  • :http_opts (Hash)

    options to pass to the connection



33
34
35
36
37
38
39
40
41
# File 'lib/ews/ews_client.rb', line 33

def initialize(endpoint, user = nil, pass = nil, opts = {})
  # dup all. @see ticket https://github.com/zenchild/Viewpoint/issues/68
  endpoint, user, pass = endpoint.dup, user.dup, pass.dup
  opts = opts.dup
  http_klass = opts[:http_class] || Viewpoint::EWS::Connection
  con = http_klass.new(endpoint, opts[:http_opts] || {})
  con.set_auth(user,pass) if(user && pass)
  @ews = SOAP::ExchangeWebService.new(con, opts)
end

Instance Attribute Details

- (Object) ews (readonly)

The instance of Viewpoint::EWS::SOAP::ExchangeWebService



19
20
21
# File 'lib/ews/ews_client.rb', line 19

def ews
  @ews
end

Instance Method Details

- (Object) auto_deepen=(deepen)



57
58
59
# File 'lib/ews/ews_client.rb', line 57

def auto_deepen=(deepen)
  set_auto_deepen deepen
end

- (Object) set_auto_deepen(deepen, behavior = :raise)

Parameters:

  • deepen (Boolean)

    true to autodeepen, false otherwise

  • behavior (Symbol) (defaults to: :raise)

    :raise, :nil When setting autodeepen to false you can choose what the behavior is when an attribute does not exist. The default is to raise a EwsMinimalObjectError.



47
48
49
50
51
52
53
54
55
# File 'lib/ews/ews_client.rb', line 47

def set_auto_deepen(deepen, behavior = :raise)
  if deepen
    @ews.auto_deepen = true
  else
    behavior = [:raise, :nil].include?(behavior) ? behavior : :raise
    @ews.no_auto_deepen_behavior = behavior
    @ews.auto_deepen = false
  end
end