samanage 1.7.3 → 1.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/changelog.md +6 -0
- data/lib/samanage/api.rb +1 -1
- data/samanage.gemspec +1 -1
- data/spec/samanage_api_spec.rb +11 -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: 3f1d8d58d2635821d87dfa526d8516973be2151d
|
4
|
+
data.tar.gz: 0377f011822eff410a4011a8219c83aac5e4ba1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 324b41e8934a09c5b37736d50d3954397fe136b1752c7c7f8afbed73d2b9aee72ada034c1ca9b1eb000cbf3d8e66b51bd6eaf0eb08f4d3db375fe63b56d7a138
|
7
|
+
data.tar.gz: 354e201555b3d61efd7dd9ee4a45d2a8e8729b94fb690b3bc76d8c004c2b84d38163a69c87cf43b56cc17fa57ec3289eb71dcfc49626ae2433500bbf2d06b935
|
data/changelog.md
CHANGED
data/lib/samanage/api.rb
CHANGED
@@ -120,7 +120,7 @@ module Samanage
|
|
120
120
|
|
121
121
|
# Return all admins in the account
|
122
122
|
def list_admins
|
123
|
-
admin_role_id = self.execute(path: 'roles.json').select{|role| role['name'] == 'Administrator'}['id']
|
123
|
+
admin_role_id = self.execute(path: 'roles.json')[:data].select{|role| role['name'] == 'Administrator'}.first['id']
|
124
124
|
self.admins.push(
|
125
125
|
self.execute(path: "users.json?role=#{admin_role_id}")[:data].map{|u| u['email']}
|
126
126
|
).flatten
|
data/samanage.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
$:.push File.expand_path("../lib", __FILE__)
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = 'samanage'
|
4
|
-
s.version = '1.7.
|
4
|
+
s.version = '1.7.4'
|
5
5
|
s.date = Date.today.strftime("%Y-%m-%d")
|
6
6
|
s.summary = "Samanage Ruby Gem"
|
7
7
|
s.description = "Connect to Samanage using Ruby!"
|
data/spec/samanage_api_spec.rb
CHANGED
@@ -32,6 +32,17 @@ describe Samanage do
|
|
32
32
|
it 'Fails with invalid token in development mode' do
|
33
33
|
expect{ Samanage::Api.new(token: 'Invalid Token', development_mode: true)}.to raise_error(Samanage::AuthorizationError)
|
34
34
|
end
|
35
|
+
|
36
|
+
# Search random Samanage::Api.list_admins user and verifiy role is admin
|
37
|
+
it 'Finds Admins' do
|
38
|
+
api_controller = Samanage::Api.new(token: TOKEN, development_mode: true)
|
39
|
+
admins = api_controller.list_admins
|
40
|
+
puts "Admins were; #{admins}"
|
41
|
+
admin_email = admins.sample.gsub('+',"%2B")
|
42
|
+
puts "Sampled Admin: #{admin_email}"
|
43
|
+
samanage_admin = api_controller.execute(path: "users.json?email=#{admin_email}")
|
44
|
+
expect(samanage_admin[:data].first['role']['name']).to eq('Administrator')
|
45
|
+
end
|
35
46
|
end
|
36
47
|
end
|
37
48
|
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.7.
|
4
|
+
version: 1.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Walls
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|