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 ADDED
Binary file
data/.gitignore CHANGED
@@ -26,3 +26,4 @@ doc/
26
26
  .wizzy
27
27
  wizzy
28
28
  .wizzy-config
29
+ .DS_Store
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
4
+ notifications:
5
+ recipients:
6
+ - davide.targa@gmail.com
7
+ - damiano.braga@gmail.com
@@ -1,6 +1,6 @@
1
1
  # RubyProvisioningApi
2
2
 
3
- TODO: Write a gem description
3
+ [Wiki](https://github.com/digitalprog/ruby_provisioning_api/wiki) | [RDocs] (http://rdoc.info/github/digitalprog/ruby_provisioning_api/frames)
4
4
 
5
5
  ## Installation
6
6
 
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = RubyProvisioningApi
2
+
3
+ Wiki[https://github.com/digitalprog/ruby_provisioning_api/wiki] | RDocs[http://rdoc.info/github/digitalprog/ruby_provisioning_api/frames]
@@ -1,3 +1,3 @@
1
- :username: brgdmn
2
- :password: 23428dami
3
- :domain: damianobraga.com
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, :user_path, :group_path, :user_actions, :group_actions, :base_apps_url, :base_path
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
- # TODO: move ca_file option into initializer
15
- client = Faraday.new(:url => url, :ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}) do |faraday|
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
- # TODO :move log level into initializer
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 DELETE https://apps-apis.google.com/a/feeds/domain/user/2.0/userName
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
- # TODO: move this inside member
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
@@ -1,3 +1,3 @@
1
1
  module RubyProvisioningApi
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  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.2
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-27 00:00:00.000000000 Z
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.md
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