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: 9818097fe34668cd39dc6ef720cf127ba5fbc2538bf89ee72ce9f65f585ed0f7
4
- data.tar.gz: 12a8026b64acb4d5f30416bb4904f89f5463ce1b880663e725e946f4bb20c2f0
3
+ metadata.gz: 8d686d850e36f8f0ca476fa18866bfd73fb913de0e8b134a2fdca08b580a2187
4
+ data.tar.gz: faa84394c013ca04239bd3f9a5659cf82129f90a8f5750a4cd8b8b2c1a66e07d
5
5
  SHA512:
6
- metadata.gz: 13c4dd4666a71ad46397c6c298f6ee7d3db374b0bac46d83bb6de540f20dae966e1098b3a0b78474bfaa889ece9ca0fc2c99e7417267523d052f3f45a96e9633
7
- data.tar.gz: ebfa0eae70d15e7de9fa9c6ca89148824f8052d7bce27d368dc66852fd9c62450948c4f4cb2df9c656339d82f76e89d5a7bc6ef5e437c22cc52eac7b21af9ae3
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 = {response: error, command: command,
64
- attributes: attributes, status: 'error'}
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
- {command: :user_get, user: attributes[:primary_email], response: response}
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 {command: :user_exists?, user: attributes[:primary_email], response: true}
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 {command: :user_exists?, user: attributes[:primary_email], response: false}
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
- {command: :user_create, user: attributes[:primary_email], response: response}
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
- {command: :user_update, user: attributes[:primary_email], response: response}
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
- {command: :user_change_password, user: attributes[:primary_email], response: response}
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
- {command: :user_reactivate, user: attributes[:primary_email], response: response}
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
- {command: :user_suspend, user: attributes[:primary_email], response: response}
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
- {command: :user_delete, user: attributes[:primary_email], response: response}
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
- {command: :users_list, filters: filters, response: response}
20
+ {response: response, attributes: filters, command: :users_list}
21
21
  end
22
22
 
23
23
  end
@@ -1,5 +1,5 @@
1
1
  module GoogleDirectory
2
2
  module Version
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_directory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bill Tihen