ruby_provisioning_api 0.0.2 → 0.0.3
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.
- data/.DS_Store +0 -0
- data/.gitignore +1 -0
- data/.travis.yml +7 -0
- data/{README.md → README.mkd} +1 -1
- data/README.rdoc +3 -0
- data/lib/ruby_provisioning_api/config/google_apps.yml +3 -3
- data/lib/ruby_provisioning_api/configuration.rb +4 -3
- data/lib/ruby_provisioning_api/connection.rb +6 -4
- data/lib/ruby_provisioning_api/user.rb +18 -2
- data/lib/ruby_provisioning_api/version.rb +1 -1
- metadata +6 -3
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/{README.md → README.mkd}
RENAMED
data/README.rdoc
ADDED
@@ -1,3 +1,3 @@
|
|
1
|
-
:username:
|
2
|
-
:password:
|
3
|
-
:domain:
|
1
|
+
:username: username
|
2
|
+
:password: password
|
3
|
+
:domain: domain
|
@@ -2,11 +2,10 @@ module RubyProvisioningApi
|
|
2
2
|
|
3
3
|
class Configuration
|
4
4
|
|
5
|
-
attr_accessor :config_file, :
|
6
|
-
attr_reader :config
|
5
|
+
attr_accessor :config_file, :base_apps_url, :base_path, :http_debug, :ca_file
|
6
|
+
attr_reader :config, :user_path, :group_path, :user_actions, :group_actions
|
7
7
|
|
8
8
|
def initialize
|
9
|
-
#@config_file = "{YOUR_DIRECTORY}/config/google_apps.yml"
|
10
9
|
config_file = "#{Rails.root}/config/google_apps.yml"
|
11
10
|
|
12
11
|
if File.exist?(config_file)
|
@@ -15,6 +14,8 @@ module RubyProvisioningApi
|
|
15
14
|
raise "RubyProvisioningApi: File #{config_file} not found, maybe you forgot to define it ?"
|
16
15
|
end
|
17
16
|
|
17
|
+
@ca_file = nil
|
18
|
+
@http_debug = false
|
18
19
|
@base_apps_url = 'https://apps-apis.google.com'
|
19
20
|
@base_path = '/a/feeds'
|
20
21
|
@user_path = "/#{@config[:domain]}/user/2.0"
|
@@ -11,11 +11,13 @@ module RubyProvisioningApi
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def client(url)
|
14
|
-
|
15
|
-
|
14
|
+
client_params = { :url => url }
|
15
|
+
if RubyProvisioningApi.configuration.ca_file
|
16
|
+
client_params[:ssl] = {:ca_file => RubyProvisioningApi.configuration.ca_file}
|
17
|
+
end
|
18
|
+
client = Faraday.new(client_params) do |faraday|
|
16
19
|
faraday.request :url_encoded # form-encode POST params
|
17
|
-
|
18
|
-
# faraday.response :logger # log requests to STDOUT
|
20
|
+
faraday.response :logger if RubyProvisioningApi.configuration.http_debug # log requests to STDOUT
|
19
21
|
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
20
22
|
end
|
21
23
|
end
|
@@ -212,14 +212,30 @@ module RubyProvisioningApi
|
|
212
212
|
save(:validate => false)
|
213
213
|
end
|
214
214
|
|
215
|
-
#Delete user
|
215
|
+
# Delete a user account
|
216
|
+
# @note This method executes a <b>DELETE</b> request to <i>apps-apis.google.com/a/feeds/domain/user/2.0/userName</i>
|
217
|
+
#
|
218
|
+
# @example Delete the user "foo"
|
219
|
+
# user = RubyProvisioningApi::User.find("foo") # => [User]
|
220
|
+
# user.delete # => true
|
221
|
+
#
|
222
|
+
# @see https://developers.google.com/google-apps/provisioning/#deleting_a_user_account
|
223
|
+
# @return [Boolean] true if the operation succeeded, false otherwise
|
224
|
+
#
|
216
225
|
def delete
|
217
226
|
params = self.class.prepare_params_for(:delete, "userName" => user_name)
|
218
227
|
response = self.class.perform(params)
|
219
228
|
end
|
220
229
|
|
221
230
|
# Returns all the groups which the user is subscribed to
|
222
|
-
#
|
231
|
+
#
|
232
|
+
# @example List all the groups which the user "foo" is subscribed to
|
233
|
+
# user = RubyProvisioningApi::User.find("foo") # => [User]
|
234
|
+
# user.groups # => [Array<Group>]
|
235
|
+
#
|
236
|
+
# @see For more info see: Group.groups
|
237
|
+
# @return [Array<Group>]
|
238
|
+
#
|
223
239
|
def groups
|
224
240
|
Group.groups(user_name)
|
225
241
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_provisioning_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-09-
|
13
|
+
date: 2012-09-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -84,11 +84,14 @@ executables: []
|
|
84
84
|
extensions: []
|
85
85
|
extra_rdoc_files: []
|
86
86
|
files:
|
87
|
+
- .DS_Store
|
87
88
|
- .gitignore
|
88
89
|
- .rvmrc
|
90
|
+
- .travis.yml
|
89
91
|
- Gemfile
|
90
92
|
- LICENSE
|
91
|
-
- README.
|
93
|
+
- README.mkd
|
94
|
+
- README.rdoc
|
92
95
|
- Rakefile
|
93
96
|
- lib/ruby_provisioning_api.rb
|
94
97
|
- lib/ruby_provisioning_api/config/google_apps.yml
|