Skip to content

Commit

Permalink
Final fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Snehit Gajjar committed Feb 8, 2019
1 parent d4e0e49 commit 8ab952d
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 70 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
ets_zabbixapi (4.1.0)
zabbixapi (4.1.0)
http (~> 2.0)
json (~> 2.0)

Expand Down Expand Up @@ -72,13 +72,13 @@ PLATFORMS

DEPENDENCIES
bundler (~> 1.0)
ets_zabbixapi!
jruby-openssl
pry
rake (~> 11.1)
rspec (>= 3.8)
rubocop (>= 0.60)
yard (>= 0.9)
zabbixapi!

BUNDLED WITH
1.16.5
4 changes: 2 additions & 2 deletions lib/zabbixapi/classes/usermacros.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ def create_or_update(data)
# @raise [HttpError] Error raised when HTTP status from Zabbix Server response is not a 200 OK.
# @return [Integer] Zabbix object id
def create_or_update_global(data)
hostmacroid = get_id_global(macro: data[:macro], hostid: data[:hostid])
hostmacroid ? update_global(data.merge(globalmacroid: globalmacroid)) : create_global(data)
globalmacroid = get_id_global(macro: data[:macro], hostid: data[:hostid])
globalmacroid ? update_global(data.merge(globalmacroid: globalmacroid)) : create_global(data)
end

private
Expand Down
32 changes: 0 additions & 32 deletions spec/httptest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,11 @@
hostid: @templateid,
steps: [
{
<<<<<<< HEAD
:name => @step_name,
:url => 'http://localhost/zabbix/',
:status_codes => '200',
:no => 1,
},
=======
name: @step_name,
url: 'http://localhost/zabbix/',
status_codes: 200,
no: 1
}
>>>>>>> 17e60e3... ETSOE-413 ets_zabbixapi gem cleanup
]
)
end
Expand All @@ -77,19 +69,11 @@
hostid: @templateid,
steps: [
{
<<<<<<< HEAD
:name => @step_name,
:url => 'http://localhost/zabbix/',
:status_codes => '200',
:no => 1,
},
=======
name: @step_name,
url: 'http://localhost/zabbix/',
status_codes: 200,
no: 1
}
>>>>>>> 17e60e3... ETSOE-413 ets_zabbixapi gem cleanup
]
)
).to eq @httptestid
Expand Down Expand Up @@ -117,19 +101,11 @@
hostid: @templateid,
steps: [
{
<<<<<<< HEAD
:name => @step_name,
:url => 'http://localhost/zabbix/',
:status_codes => '200',
:no => 1,
},
=======
name: @step_name,
url: 'http://localhost/zabbix/',
status_codes: 200,
no: 1
}
>>>>>>> 17e60e3... ETSOE-413 ets_zabbixapi gem cleanup
]
)
).to eq @httptestid
Expand All @@ -144,19 +120,11 @@
status: 0,
steps: [
{
<<<<<<< HEAD
:name => @step_name,
:url => 'http://localhost/zabbix/',
:status_codes => '200',
:no => 1,
},
=======
name: @step_name,
url: 'http://localhost/zabbix/',
status_codes: 200,
no: 1
}
>>>>>>> 17e60e3... ETSOE-413 ets_zabbixapi gem cleanup
]
)
).to eq @httptestid
Expand Down
4 changes: 2 additions & 2 deletions spec/zabbixapi/classes/items_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
key_: nil,
hostid: nil,
delay: 60,
history: 3600,
history: 60,
status: 0,
type: 7,
snmp_community: '',
Expand All @@ -42,7 +42,7 @@
snmpv3_authpassphrase: '',
snmpv3_privpassphrase: '',
formula: 0,
trends: 86400,
trends: 365,
logtimefmt: '',
valuemapid: 0,
delay_flex: '',
Expand Down
2 changes: 1 addition & 1 deletion spec/zabbixapi/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
end

it 'sets api_version class variable' do
expect(subject.instance_variable_get(:@version)).to eq result
expect(subject.instance_variable_get(:@api_version)).to eq result
end
end
end
4 changes: 2 additions & 2 deletions spec/zabbixapi/classes/usermacros_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
describe '.indentify' do
subject { usermacros_mock.indentify }

it { is_expected.to eq 'usermacro' }
it { is_expected.to eq 'macro' }
end

describe '.method_name' do
subject { usermacros_mock.method_name }

it { is_expected.to eq 'macro' }
it { is_expected.to eq 'usermacro' }
end

describe '.get_id' do
Expand Down
3 changes: 0 additions & 3 deletions spec/zabbixapi/classes/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

it { is_expected.to eq 'userids' }
end
<<<<<<< HEAD
=======

describe '.add_medias' do
subject { users_mock.add_medias(data) }
Expand Down Expand Up @@ -87,5 +85,4 @@
end
end
end
>>>>>>> bd80b37... ETSOE-458: [ets_zabbixapi] Rspec for Client class and other remaining classes in zabbixapi/classes/ dir
end
19 changes: 1 addition & 18 deletions spec/zabbixapi/client_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<<<<<<< HEAD

=======
>>>>>>> bd80b37... ETSOE-458: [ets_zabbixapi] Rspec for Client class and other remaining classes in zabbixapi/classes/ dir
require 'spec_helper'

describe 'ZabbixApi::Client' do
Expand Down Expand Up @@ -164,13 +160,8 @@
end
end

<<<<<<< HEAD
context 'when major api_version is not supported' do
let(:api_version) { 'not_a_valid_version' }
=======
context 'when major api_version is not 4' do
let(:api_version) { '3.0.0' }
>>>>>>> bd80b37... ETSOE-458: [ets_zabbixapi] Rspec for Client class and other remaining classes in zabbixapi/classes/ dir

before { allow(ENV).to receive(:[]).with('http_proxy').and_return(nil) }

Expand Down Expand Up @@ -281,16 +272,11 @@
allow(mock_post).to receive(:body=).with(body)
allow(http_mock).to receive(:request).with(mock_post).and_return(response)
allow(http_mock).to receive(:use_ssl=).with(true)
<<<<<<< HEAD

allow(http_mock).to receive(:verify_mode=).with(0)
allow(http_mock).to receive(:open_timeout=).with(timeout)
allow(http_mock).to receive(:read_timeout=).with(timeout)
=======
allow(http_mock).to receive(:verify_mode=).with(true)
allow(http_mock).to receive(:open_timeout=).with(timeout)
allow(http_mock).to receive(:read_timeout=).with(timeout)
allow(OpenSSL::SSL).to receive(:VERIFY_NONE).and_return(true)
>>>>>>> bd80b37... ETSOE-458: [ets_zabbixapi] Rspec for Client class and other remaining classes in zabbixapi/classes/ dir
allow(response).to receive(:[]).with('error').and_return('Test error')
end

Expand Down Expand Up @@ -438,14 +424,11 @@
let(:parsed_body) do
"{\n \"params\": \"testparams\"\n}"
end
<<<<<<< HEAD
=======
let(:result) do
{
'result' => 'testresult'
}
end
>>>>>>> bd80b37... ETSOE-458: [ets_zabbixapi] Rspec for Client class and other remaining classes in zabbixapi/classes/ dir

before do
allow_any_instance_of(ZabbixApi::Client).to receive(:api_version).and_return('4.0.0')
Expand Down
18 changes: 10 additions & 8 deletions zabbixapi.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
lib = File.expand_path('lib', __dir__)
# coding: utf-8

lib = File.expand_path('../lib', __FILE__)

$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Expand All @@ -9,19 +11,19 @@ Gem::Specification.new do |spec|
spec.add_dependency 'json', '~> 2.0'
spec.add_development_dependency 'bundler', '~> 1.0'

spec.name = 'ets_zabbixapi'
spec.name = 'zabbixapi'
spec.version = ZabbixApi::VERSION
spec.authors = ['Scott Mackensen']
spec.email = ['scott.mackensen@cerner.com']
spec.authors = ['Vasiliev D.V.', 'Ivan Evtuhovich']
spec.email = ['[email protected]', 'evtuhovich@gmail.com']

spec.summary = 'Internal Fork of the Zabbixapi Gem located here:https://github.com/express42/zabbixapi'
spec.description = 'Simple and lightweight ruby module for working with the Zabbix API'
spec.homepage = 'https://github.cerner.com/ETS/ets_zabbixapi'
spec.summary = 'Simple and lightweight ruby module for working with the Zabbix API'
spec.description = 'Allows you to work with zabbix api from ruby.'
spec.homepage = 'https://github.com/express42/zabbixapi'
spec.licenses = 'MIT'

spec.rubyforge_project = 'zabbixapi'

spec.files = ['.yardopts', 'CHANGELOG.md', 'LICENSE.md', 'README.md', 'zabbixapi.gemspec'] + Dir['lib/**/*.rb']
spec.require_paths = 'lib'
spec.required_ruby_version = '>= 2.2.0'
spec.required_ruby_version = '>= 2.0.0'
end

0 comments on commit 8ab952d

Please sign in to comment.