class Autodiscover::Client

Constants

DEFAULT_HTTP_TIMEOUT

Attributes

domain[R]
email[R]
http[R]

Public Class Methods

new(email:, password:, username: nil, domain: nil, connect_timeout: DEFAULT_HTTP_TIMEOUT) click to toggle source

@param email [String] An e-mail to use for autodiscovery. It will be

used as the default username.

@param password [String] @param username [String] An optional username if you want to authenticate

with something other than the e-mail. For instance DOMAIN\user

@param domain [String] An optional domain to provide as an override for

the one parsed from the e-mail.
# File lib/autodiscover/client.rb, line 13
def initialize(email:, password:, username: nil, domain: nil, connect_timeout: DEFAULT_HTTP_TIMEOUT)
  @email = email
  @domain = domain || @email.split("@").last
  @http = HTTPClient.new
  @http.connect_timeout = connect_timeout if connect_timeout
  @username = username || email
  @http.set_auth(nil, @username, password)
end

Public Instance Methods

autodiscover(type: :pox, **options) click to toggle source

@param type [Symbol] The type of response. Right now this is just :pox @param [Hash] **options

# File lib/autodiscover/client.rb, line 24
def autodiscover(type: :pox, **options)
  case type
  when :pox
    PoxRequest.new(self, **options).autodiscover
  else
    raise Autodiscover::ArgumentError, "Not a valid autodiscover type (#{type})."
  end
end