Class: Rews::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/rews.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint, auth_type, user, password) ⇒ Client

Rews::Client.new(‘exchange.foo.com/EWS/Exchange.asmx’, :ntlm, ‘DOMAIN\user’, ‘password’) Rews::Client.new(‘exchange.foo.com/EWS/Exchange.asmx’, :basic, ‘DOMAIN\user’, ‘password’)



30
31
32
33
34
35
36
37
38
# File 'lib/rews.rb', line 30

def initialize(endpoint, auth_type, user, password)
  @client = Savon::Client.new do
    wsdl.endpoint = endpoint
    wsdl.namespace = SCHEMA_MESSAGES
    
    http.auth.ssl.verify_mode = :none
    http.auth.send(auth_type, user, password)
  end
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



25
26
27
# File 'lib/rews.rb', line 25

def client
  @client
end

#logdevObject

Returns the value of attribute logdev.



26
27
28
# File 'lib/rews.rb', line 26

def logdev
  @logdev
end

Instance Method Details

#distinguished_folder_id(id, mailbox_email = nil) ⇒ Object

client.distinguished_folder_id(‘inbox’) client.distinguished_folder_id(‘inbox’, ‘[email protected]’) # to get a folder from another mailbox



42
43
44
# File 'lib/rews.rb', line 42

def distinguished_folder_id(id, mailbox_email=nil)
  Folder::DistinguishedFolderId.new(client, id, mailbox_email)
end

#log {|logger| ... } ⇒ Object

Yields:



46
47
48
# File 'lib/rews.rb', line 46

def log
  yield logger if @logdev
end

#loggerObject



50
51
52
53
# File 'lib/rews.rb', line 50

def logger
  return @logger if @logger
  @logger = Logger.new(@logdev) if @logdev
end