mtik 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.txt +1 -1
  2. data/VERSION.txt +1 -1
  3. data/lib/mtik/connection.rb +10 -1
  4. metadata +3 -3
data/README.txt CHANGED
@@ -47,7 +47,7 @@ For documentation on the MikroTik RouterOS APi, see
47
47
 
48
48
  To install MTik is through its GEM file:
49
49
 
50
- % [sudo] gem install mtik-3.1.0.gem
50
+ % [sudo] gem install mtik-4.0.0.gem
51
51
 
52
52
  == License
53
53
 
@@ -1 +1 @@
1
- 4.0.0
1
+ 4.0.1
@@ -65,6 +65,7 @@ class MTik::Connection
65
65
  @cmd_timeout = args[:cmd_timeout] || MTik::CMD_TIMEOUT
66
66
  @data = ''
67
67
  @parsing = false ## Recursion flag
68
+ @os_version = nil
68
69
 
69
70
  ## Initiate connection and immediately login to device:
70
71
  login
@@ -74,7 +75,8 @@ class MTik::Connection
74
75
  def outstanding
75
76
  return @requests.length
76
77
  end
77
- attr_reader :requests, :host, :port, :user, :pass, :conn_timeout, :cmd_timeout
78
+ attr_reader :requests, :host, :port, :user, :pass, :conn_timeout, :cmd_timeout,
79
+ :os_version
78
80
 
79
81
  ## Internal utility function:
80
82
  ## Sugar-coat ["0deadf0015"].pack('H*') so one can just do
@@ -116,6 +118,13 @@ class MTik::Connection
116
118
  @sock = nil
117
119
  raise MTik::Error.new('Login failed: Unknown response to login.')
118
120
  end
121
+
122
+ ## Request the RouterOS version of the device as different versions
123
+ ## sometimes use slightly different command parameters:
124
+ reply = get_reply('/system/resource/getall')
125
+ if reply.first.key?('!re') && reply.first['version']
126
+ @os_version = reply.first['version']
127
+ end
119
128
  end
120
129
 
121
130
  ## Connect to the device
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtik
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-03-25 00:00:00.000000000Z
12
+ date: 2012-02-09 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: MTik implements the MikroTik RouterOS API for use in Ruby.
15
15
  email: email_not_accepted@aarongifford.com
@@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
57
  version: '0'
58
58
  requirements: []
59
59
  rubyforge_project: mtik
60
- rubygems_version: 1.7.2
60
+ rubygems_version: 1.8.11
61
61
  signing_key:
62
62
  specification_version: 3
63
63
  summary: MTik implements the MikroTik RouterOS API for use in Ruby.