connection.rb 880 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. class Sequencer
  2. class Unit
  3. module Exchange
  4. class Connection < Sequencer::Unit::Common::Provider::Fallback
  5. uses :ews_config
  6. provides :ews_connection
  7. private
  8. def ews_connection
  9. Viewpoint::EWSClient.new(
  10. config[:endpoint],
  11. config[:user],
  12. config[:password],
  13. additional_opts
  14. )
  15. end
  16. def config
  17. @config ||= begin
  18. ews_config || ::Import::Exchange.config
  19. end
  20. end
  21. def additional_opts
  22. @additional_opts ||= begin
  23. http_opts
  24. end
  25. end
  26. def http_opts
  27. return {} if config[:disable_ssl_verify].blank?
  28. {
  29. http_opts: {
  30. ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE
  31. }
  32. }
  33. end
  34. end
  35. end
  36. end
  37. end