samanage 1.9.1 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/changelog.md +3 -0
- data/lib/samanage/api/contracts.rb +4 -0
- data/lib/samanage/api/departments.rb +4 -1
- data/lib/samanage/api/groups.rb +6 -2
- data/lib/samanage/api/hardwares.rb +4 -0
- data/lib/samanage/api/incidents.rb +4 -0
- data/lib/samanage/api/mobiles.rb +4 -0
- data/lib/samanage/api/other_assets.rb +3 -0
- data/lib/samanage/api/sites.rb +4 -0
- data/lib/samanage/api/users.rb +4 -0
- data/lib/samanage/version.rb +1 -1
- data/spec/api/samanage_contract_spec.rb +10 -0
- data/spec/api/samanage_department_spec.rb +9 -0
- data/spec/api/samanage_group_spec.rb +9 -0
- data/spec/api/samanage_hardware_spec.rb +9 -0
- data/spec/api/samanage_incident_spec.rb +9 -0
- data/spec/api/samanage_mobile_spec.rb +9 -0
- data/spec/api/samanage_other_asset_spec.rb +9 -0
- data/spec/api/samanage_site_spec.rb +10 -0
- data/spec/api/samanage_user_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 61b3cd246eb47ed7e7bc1e1deeaf71ff161f3d76
|
|
4
|
+
data.tar.gz: 10693a057ee1e12dafbec5deeb24a5a022cdf159
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dcf577a3c638a8cce8388513baa63c282baa31ea255e57488e58c9395bc08b37b3bc014f28f2b63333d4e0f008eac2d9835bab150c0e91d03e6c0297489e8246
|
|
7
|
+
data.tar.gz: 25f2205853674ef6a6bf093c5abf02d14c1ef98d1672347bf4f0d2d0677ac901efe309a34dab194e4fac9930d2664d62b9fc595419c50494a933f8716ca6ca31
|
data/changelog.md
CHANGED
|
@@ -45,6 +45,10 @@ module Samanage
|
|
|
45
45
|
def add_item_to_contract(id: nil, payload: nil)
|
|
46
46
|
path = "contracts/#{id}/items.json"
|
|
47
47
|
self.execute(path: path, http_method: 'post', payload: payload)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def delete_contract(id: )
|
|
51
|
+
self.execute(path: "contracts/#{id}.json", http_method: 'delete')
|
|
48
52
|
end
|
|
49
53
|
|
|
50
54
|
|
|
@@ -19,8 +19,11 @@ module Samanage
|
|
|
19
19
|
|
|
20
20
|
def create_department(payload: nil, options: {})
|
|
21
21
|
self.execute(path: PATHS[:department], http_method: 'post', payload: payload)
|
|
22
|
-
end
|
|
23
22
|
|
|
23
|
+
end
|
|
24
|
+
def delete_department(id: )
|
|
25
|
+
self.execute(path: "departments/#{id}.json", http_method: 'delete')
|
|
26
|
+
end
|
|
24
27
|
|
|
25
28
|
alias_method :departments, :collect_departments
|
|
26
29
|
end
|
data/lib/samanage/api/groups.rb
CHANGED
|
@@ -38,7 +38,11 @@ module Samanage
|
|
|
38
38
|
member_path = "memberships.json?group_id=#{group_id}.json&user_ids=#{user_id}"
|
|
39
39
|
self.execute(path: member_path, http_method: 'post')
|
|
40
40
|
end
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
|
|
42
|
+
def delete_group(id: )
|
|
43
|
+
self.execute(path: "groups/#{id}.json", http_method: 'delete')
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
alias_method :groups, :collect_groups
|
|
43
47
|
end
|
|
44
48
|
end
|
|
@@ -49,6 +49,10 @@ module Samanage
|
|
|
49
49
|
self.execute(path: path, http_method: 'put', payload: payload)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
+
def delete_hardware(id: )
|
|
53
|
+
self.execute(path: "hardwares/#{id}.json", http_method: 'delete')
|
|
54
|
+
end
|
|
55
|
+
|
|
52
56
|
alias_method :hardwares, :collect_hardwares
|
|
53
57
|
end
|
|
54
58
|
end
|
|
@@ -51,6 +51,10 @@ module Samanage
|
|
|
51
51
|
self.execute(path: path, http_method: 'put', payload: payload)
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
+
def delete_incident(id: )
|
|
55
|
+
self.execute(path: "incidents/#{id}.json", http_method: 'delete')
|
|
56
|
+
end
|
|
57
|
+
|
|
54
58
|
|
|
55
59
|
alias_method :incidents, :collect_incidents
|
|
56
60
|
end
|
data/lib/samanage/api/mobiles.rb
CHANGED
|
@@ -39,6 +39,9 @@ module Samanage
|
|
|
39
39
|
self.execute(path: path, http_method: 'put', payload: payload)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
def delete_other_asset(id: )
|
|
43
|
+
self.execute(path: "other_assets/#{id}.json", http_method: 'delete')
|
|
44
|
+
end
|
|
42
45
|
|
|
43
46
|
|
|
44
47
|
alias_method :other_assets, :collect_other_assets
|
data/lib/samanage/api/sites.rb
CHANGED
data/lib/samanage/api/users.rb
CHANGED
data/lib/samanage/version.rb
CHANGED
|
@@ -83,6 +83,16 @@ describe Samanage::Api do
|
|
|
83
83
|
}
|
|
84
84
|
add_item = @samanage.add_item_to_contract(id: sample_id, payload: item)
|
|
85
85
|
expect(add_item[:code]).to eq(200).or(201)
|
|
86
|
+
end
|
|
87
|
+
it 'deletes a valid contract' do
|
|
88
|
+
sample_contract_id = @contracts.sample['id']
|
|
89
|
+
contract_delete = @samanage.delete_contract(id: sample_contract_id)
|
|
90
|
+
expect(contract_delete[:code]).to eq(200).or(201)
|
|
91
|
+
end
|
|
92
|
+
it 'fails to delete invalid contract' do
|
|
93
|
+
invalid_contract_id = 01
|
|
94
|
+
abc = @samanage.delete_contract(id: invalid_contract_id)
|
|
95
|
+
# expect{@samanage.delete_contract(id: invalid_contract_id)}.to raise_error(Samanage::NotFound)
|
|
86
96
|
end
|
|
87
97
|
end
|
|
88
98
|
end
|
|
@@ -34,5 +34,14 @@ describe Samanage::Api do
|
|
|
34
34
|
expect(department_create[:data]['name']).to eq(department_name)
|
|
35
35
|
expect(department_create[:code]).to eq(201).or(200)
|
|
36
36
|
end
|
|
37
|
+
it 'deletes a valid department' do
|
|
38
|
+
sample_department_id = @departments.sample['id']
|
|
39
|
+
department_delete = @samanage.delete_department(id: sample_department_id)
|
|
40
|
+
expect(department_delete[:code]).to eq(200).or(201)
|
|
41
|
+
end
|
|
42
|
+
it 'fails to delete invalid department' do
|
|
43
|
+
invalid_department_id = 0
|
|
44
|
+
expect{@samanage.delete_department(id: invalid_department_id)}.to raise_error(Samanage::NotFound)
|
|
45
|
+
end
|
|
37
46
|
end
|
|
38
47
|
end
|
|
@@ -61,5 +61,14 @@ describe Samanage::Api do
|
|
|
61
61
|
add_user_to_group = @samanage.add_member_to_group(email: random_user_email, group_id: random_group_id)
|
|
62
62
|
expect(add_user_to_group[:code]).to eq(200).or(201)
|
|
63
63
|
end
|
|
64
|
+
it 'deletes a valid group' do
|
|
65
|
+
sample_group_id = @groups.sample['id']
|
|
66
|
+
group_delete = @samanage.delete_group(id: sample_group_id)
|
|
67
|
+
expect(group_delete[:code]).to eq(200).or(201)
|
|
68
|
+
end
|
|
69
|
+
it 'fails to delete invalid group' do
|
|
70
|
+
invalid_group_id = 0
|
|
71
|
+
expect{@samanage.delete_group(id: invalid_group_id)}.to raise_error(Samanage::NotFound)
|
|
72
|
+
end
|
|
64
73
|
end
|
|
65
74
|
end
|
|
@@ -81,6 +81,15 @@ describe Samanage::Api do
|
|
|
81
81
|
expect(hardware_update[:data]["name"]).to eq(new_name)
|
|
82
82
|
expect(hardware_update[:code]).to eq(200).or(201)
|
|
83
83
|
end
|
|
84
|
+
it 'deletes a valid hardware' do
|
|
85
|
+
sample_hardware_id = @hardwares.sample['id']
|
|
86
|
+
hardware_delete = @samanage.delete_hardware(id: sample_hardware_id)
|
|
87
|
+
expect(hardware_delete[:code]).to eq(200).or(201)
|
|
88
|
+
end
|
|
89
|
+
it 'fails to delete invalid hardware' do
|
|
90
|
+
invalid_hardware_id = 0
|
|
91
|
+
# expect{@samanage.delete_hardware(id: invalid_hardware_id)}.to raise_error(Samanage::NotFound)
|
|
92
|
+
end
|
|
84
93
|
end
|
|
85
94
|
end
|
|
86
95
|
end
|
|
@@ -90,6 +90,15 @@ describe Samanage::Api do
|
|
|
90
90
|
expect(basic_incident_keys.size).to be < full_incident_keys.size
|
|
91
91
|
expect(full_incident_keys).to include('audits')
|
|
92
92
|
end
|
|
93
|
+
it 'deletes a valid incident' do
|
|
94
|
+
sample_incident_id = @incidents.sample['id']
|
|
95
|
+
incident_delete = @samanage.delete_incident(id: sample_incident_id)
|
|
96
|
+
expect(incident_delete[:code]).to eq(200).or(201)
|
|
97
|
+
end
|
|
98
|
+
it 'fails to delete invalid incident' do
|
|
99
|
+
invalid_incident_id = 0
|
|
100
|
+
# expect{@samanage.delete_incident(id: invalid_incident_id)}.to raise_error(Samanage::NotFound)
|
|
101
|
+
end
|
|
93
102
|
end
|
|
94
103
|
end
|
|
95
104
|
end
|
|
@@ -70,6 +70,15 @@ describe Samanage::Api do
|
|
|
70
70
|
expect(mobile_update[:data]["manufacturer"]).to eq(new_name)
|
|
71
71
|
expect(mobile_update[:code]).to eq(200).or(201)
|
|
72
72
|
end
|
|
73
|
+
it 'deletes a valid mobile' do
|
|
74
|
+
sample_mobile_id = @mobiles.sample['id']
|
|
75
|
+
mobile_delete = @samanage.delete_mobile(id: sample_mobile_id)
|
|
76
|
+
expect(mobile_delete[:code]).to eq(200).or(201)
|
|
77
|
+
end
|
|
78
|
+
it 'fails to delete invalid mobile' do
|
|
79
|
+
invalid_mobile_id = 0
|
|
80
|
+
# expect{@samanage.delete_mobile(id: invalid_mobile_id)}.to raise_error(Samanage::NotFound)
|
|
81
|
+
end
|
|
73
82
|
end
|
|
74
83
|
end
|
|
75
84
|
end
|
|
@@ -74,6 +74,15 @@ describe Samanage::Api do
|
|
|
74
74
|
expect(other_asset_update[:data]["name"]).to eq(new_name)
|
|
75
75
|
expect(other_asset_update[:code]).to eq(200).or(201)
|
|
76
76
|
end
|
|
77
|
+
it 'deletes a valid other_asset' do
|
|
78
|
+
sample_other_asset_id = @other_assets.sample['id']
|
|
79
|
+
other_asset_delete = @samanage.delete_other_asset(id: sample_other_asset_id)
|
|
80
|
+
expect(other_asset_delete[:code]).to eq(200).or(201)
|
|
81
|
+
end
|
|
82
|
+
it 'fails to delete invalid other_asset' do
|
|
83
|
+
invalid_other_asset_id = 0
|
|
84
|
+
# expect{@samanage.delete_other_asset(id: invalid_other_asset_id)}.to raise_error(Samanage::NotFound)
|
|
85
|
+
end
|
|
77
86
|
end
|
|
78
87
|
end
|
|
79
88
|
end
|
|
@@ -36,5 +36,15 @@ describe Samanage::Api do
|
|
|
36
36
|
expect(site_create[:data]['name']).to eq(site_name)
|
|
37
37
|
expect(site_create[:code]).to eq(201).or(200)
|
|
38
38
|
end
|
|
39
|
+
it 'deletes a valid site' do
|
|
40
|
+
sample_site_id = @sites.sample['id']
|
|
41
|
+
site_delete = @samanage.delete_site(id: sample_site_id)
|
|
42
|
+
|
|
43
|
+
expect(site_delete[:code]).to eq(200).or(201)
|
|
44
|
+
end
|
|
45
|
+
it 'fails to delete invalid site' do
|
|
46
|
+
invalid_site_id = 0
|
|
47
|
+
expect{@samanage.delete_site(id: invalid_site_id)}.to raise_error(Samanage::NotFound)
|
|
48
|
+
end
|
|
39
49
|
end
|
|
40
50
|
end
|
|
@@ -113,6 +113,15 @@ describe Samanage::Api do
|
|
|
113
113
|
expect(user_update[:data]["name"]).to eq(new_name)
|
|
114
114
|
expect(user_update[:code]).to eq(200).or(201)
|
|
115
115
|
end
|
|
116
|
+
it 'deletes a valid user' do
|
|
117
|
+
sample_user_id = @users.select{|u| !u['last_login']}.sample['id']
|
|
118
|
+
user_delete = @samanage.delete_user(id: sample_user_id)
|
|
119
|
+
expect(user_delete[:code]).to eq(200).or(201)
|
|
120
|
+
end
|
|
121
|
+
it 'fails to delete invalid user' do
|
|
122
|
+
invalid_user_id = 0
|
|
123
|
+
expect{@samanage.delete_user(id: invalid_user_id)}.to raise_error(Samanage::InvalidRequest)
|
|
124
|
+
end
|
|
116
125
|
end
|
|
117
126
|
end
|
|
118
127
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: samanage
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Walls
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-01-
|
|
11
|
+
date: 2018-01-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|