Class: Autodiscover::ServerVersionParser

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

Constant Summary collapse

VERSIONS =
{
  8 => {
    0 => "Exchange2007",
    1 => "Exchange2007_SP1",
    2 => "Exchange2007_SP1",
    3 => "Exchange2007_SP1",
  },
  14 => {
    0 => "Exchange2010",
    1 => "Exchange2010_SP1",
    2 => "Exchange2010_SP2",
    3 => "Exchange2010_SP2",
  },
  15 => {
    0 => "Exchange2013",
    1 => "Exchange2013_SP1",
  }
}

Instance Method Summary collapse

Constructor Details

#initialize(hexversion) ⇒ ServerVersionParser

Returns a new instance of ServerVersionParser.



23
24
25
# File 'lib/autodiscover/server_version_parser.rb', line 23

def initialize(hexversion)
  @version = hexversion.hex.to_s(2).rjust(hexversion.size*4, '0')
end

Instance Method Details

#buildObject



35
36
37
# File 'lib/autodiscover/server_version_parser.rb', line 35

def build
  @version[17..31].to_i(2)
end

#exchange_versionObject



39
40
41
42
# File 'lib/autodiscover/server_version_parser.rb', line 39

def exchange_version
  v = VERSIONS[major][minor]
  v.nil? ? VERIONS[8][0] : v
end

#majorObject



27
28
29
# File 'lib/autodiscover/server_version_parser.rb', line 27

def major
  @version[4..9].to_i(2)
end

#minorObject



31
32
33
# File 'lib/autodiscover/server_version_parser.rb', line 31

def minor
  @version[10..15].to_i(2)
end