2017-08-14 11:56:23 +00:00
|
|
|
class Sequencer
|
|
|
|
class Unit
|
|
|
|
module Exchange
|
|
|
|
class Connection < Sequencer::Unit::Base
|
|
|
|
|
|
|
|
uses :ews_config
|
|
|
|
provides :ews_connection
|
|
|
|
|
|
|
|
def process
|
|
|
|
# check if EWS connection is already given (sub sequence)
|
|
|
|
return if state.provided?(:ews_connection)
|
|
|
|
|
|
|
|
state.provide(:ews_connection) do
|
2017-11-03 10:40:11 +00:00
|
|
|
Viewpoint::EWSClient.new(
|
|
|
|
config[:endpoint],
|
|
|
|
config[:user],
|
|
|
|
config[:password],
|
|
|
|
additional_opts
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def config
|
|
|
|
@config ||= begin
|
|
|
|
ews_config || ::Import::Exchange.config
|
|
|
|
end
|
|
|
|
end
|
2017-08-14 11:56:23 +00:00
|
|
|
|
2017-11-03 10:40:11 +00:00
|
|
|
def additional_opts
|
|
|
|
@additional_opts ||= begin
|
|
|
|
http_opts
|
2017-08-14 11:56:23 +00:00
|
|
|
end
|
|
|
|
end
|
2017-11-03 10:40:11 +00:00
|
|
|
|
|
|
|
def http_opts
|
|
|
|
return {} if config[:disable_ssl_verify].blank?
|
|
|
|
{
|
|
|
|
http_opts: {
|
|
|
|
ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
2017-08-14 11:56:23 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|