google_directory 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d686d850e36f8f0ca476fa18866bfd73fb913de0e8b134a2fdca08b580a2187
|
4
|
+
data.tar.gz: faa84394c013ca04239bd3f9a5659cf82129f90a8f5750a4cd8b8b2c1a66e07d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f4af38fd52d322d6a2a4844e29c3c013c88f74af7e1a3c91e7fe5d540dbbbb28e973eb142f44ff97f46c0b35451a0fa008970c7ac4653e8fb075fe9f1e3ed45
|
7
|
+
data.tar.gz: b70dc522431b30f6cdd4edc57bc3053090e2694e3ee8569f4ac54bd6cb137bbc88450da4d031e3376b551e1bd1bd9184a67090ff39ec746255b4dd030ad61050
|
@@ -60,8 +60,9 @@ module GoogleDirectory
|
|
60
60
|
response = send( command, attributes: attributes )
|
61
61
|
response[:status] = 'success'
|
62
62
|
rescue Google::Apis::ClientError => error
|
63
|
-
response = {
|
64
|
-
attributes: attributes,
|
63
|
+
response = {status: 'error', response: error,
|
64
|
+
attributes: attributes, command: command,
|
65
|
+
}
|
65
66
|
end
|
66
67
|
response
|
67
68
|
end
|
@@ -13,7 +13,7 @@ module GoogleDirectory
|
|
13
13
|
# @return [Hash] formatted as {success: {command: :user_get, attributes: {primary_email: "user@domain"}, response: GoogleUserObject } }
|
14
14
|
def user_get( attributes: )
|
15
15
|
response = service.get_user( attributes[:primary_email] )
|
16
|
-
{
|
16
|
+
{response: response, attributes: attributes[:primary_email], command: :user_get}
|
17
17
|
end
|
18
18
|
|
19
19
|
# @note Test if user exists in Google Directory
|
@@ -23,10 +23,10 @@ module GoogleDirectory
|
|
23
23
|
def user_exists?( attributes: )
|
24
24
|
begin
|
25
25
|
response = service.get_user( attributes[:primary_email] )
|
26
|
-
return {
|
26
|
+
return {response: true, attributes: attributes[:primary_email], command: :user_exists?}
|
27
27
|
rescue Google::Apis::ClientError => error
|
28
28
|
if error.message.include? 'notFound'
|
29
|
-
return {
|
29
|
+
return {response: false, attributes: attributes[:primary_email], command: :user_exists?}
|
30
30
|
else
|
31
31
|
raise error
|
32
32
|
end
|
@@ -46,7 +46,7 @@ module GoogleDirectory
|
|
46
46
|
user_object = Google::Apis::AdminDirectoryV1::User.new user_attr
|
47
47
|
# create user in directory services
|
48
48
|
response = service.insert_user( user_object )
|
49
|
-
{
|
49
|
+
{response: response, attributes: attributes[:primary_email], command: :user_create}
|
50
50
|
end
|
51
51
|
|
52
52
|
# @note updates an exising Google Directory User
|
@@ -56,7 +56,7 @@ module GoogleDirectory
|
|
56
56
|
def user_update( attributes: )
|
57
57
|
# create a user object for google to update
|
58
58
|
response = update_user( attributes )
|
59
|
-
{
|
59
|
+
{response: response, attributes: attributes[:primary_email], command: :user_update}
|
60
60
|
end
|
61
61
|
|
62
62
|
# @note updates an exising Google Directory User password - convience method instead of using :user_update
|
@@ -69,7 +69,7 @@ module GoogleDirectory
|
|
69
69
|
user_attr = defaults.merge( attributes )
|
70
70
|
|
71
71
|
response = update_user( user_attr )
|
72
|
-
{
|
72
|
+
{response: response, attributes: attributes[:primary_email], command: :user_change_password}
|
73
73
|
end
|
74
74
|
|
75
75
|
# @note activates an exising Google Directory User password - convience method instead of using :user_update
|
@@ -81,7 +81,7 @@ module GoogleDirectory
|
|
81
81
|
user_attr = defaults.merge( attributes )
|
82
82
|
|
83
83
|
response = update_user( user_attr )
|
84
|
-
{
|
84
|
+
{response: response, attributes: attributes[:primary_email], command: :user_reactivate}
|
85
85
|
end
|
86
86
|
|
87
87
|
# @note suspends an exising Google Directory User password - convience method instead of using :user_update
|
@@ -93,7 +93,7 @@ module GoogleDirectory
|
|
93
93
|
user_attr = defaults.merge( attributes )
|
94
94
|
|
95
95
|
response = update_user( user_attr )
|
96
|
-
{
|
96
|
+
{response: response, attributes: attributes[:primary_email], command: :user_suspend}
|
97
97
|
end
|
98
98
|
|
99
99
|
# @note deletes an exising Google Directory User
|
@@ -102,7 +102,7 @@ module GoogleDirectory
|
|
102
102
|
# @return [Hash] formatted as {success: {command: :user_delete, attributes: {primary_email: "user@domain"}, response: "" } }
|
103
103
|
def user_delete( attributes: )
|
104
104
|
response = service.delete_user( attributes[:primary_email] )
|
105
|
-
{
|
105
|
+
{response: response, attributes: attributes[:primary_email], command: :user_delete}
|
106
106
|
end
|
107
107
|
|
108
108
|
private
|
@@ -17,7 +17,7 @@ module GoogleDirectory
|
|
17
17
|
defaults = { max_results: 10, order_by: 'email' }
|
18
18
|
filters = defaults.merge( attributes )
|
19
19
|
response = service.list_users( filters )
|
20
|
-
{
|
20
|
+
{response: response, attributes: filters, command: :users_list}
|
21
21
|
end
|
22
22
|
|
23
23
|
end
|