google-directory 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31dd3d1b04d40d4b86f41f51811ff1b04b5ce090
4
- data.tar.gz: a96170d567eb79df73a110431dc92a9cd490b341
3
+ metadata.gz: 318472d19433eeb4cc36a64d59d6f64af06f3d25
4
+ data.tar.gz: 8839b1d534940f0ab3c479259651674d3a8a917a
5
5
  SHA512:
6
- metadata.gz: 0e40b022c65cfd68efe99c77539eeb74e1a8a6a9228de041628884154a2dd6e5c02f25d0995cd604f1d322967f6cd93f618b49aacaadb10770dc1cea2349f446
7
- data.tar.gz: 4cd5d284c3cf4eb2065a1a02c60ca900c2a2e9c83353c78297e8ae941e630cf84054739d5097a9d1f58fe80957ec6c458b4e8dbcfc330f64928078216b5dc1a9
6
+ metadata.gz: 3c5f9a0ad231267f607737a36a8c2a7528f28f1307060b4400a0e9ba4fcec53db40988c3ba3ccd3d5ec1bc158cb10675a2980e22951d9e6d6ab144eac54c91cd
7
+ data.tar.gz: 9de6daf97deb0bd429873efac799bf5d0ad9a894f024d1a564a467eec5403255652d6d2c2cebeede9b585dd46e10f91e54e4f7e31ea92ee85f7c5fafd82b0df8
data/.gitignore CHANGED
@@ -3,6 +3,7 @@
3
3
  .bundle
4
4
  .rvmrc
5
5
  *.log
6
+ *.gem
6
7
 
7
8
  test/*
8
9
  pkg/*
data/README.md CHANGED
@@ -19,17 +19,20 @@ First configure your API in `initializers/google_directory.rb`
19
19
 
20
20
  ``` ruby
21
21
  GoogleDirectory.configure do
22
-
22
+
23
+ # Optional Token Store
23
24
  use_yaml Rails.root.join('config', 'google_directory.yaml')
24
25
 
26
+ # Required
25
27
  admin_email 'admin@domain.com'
26
-
27
28
  key_file Rails.root.join('config', 'keys', 'private_key.p12')
28
-
29
29
  key_passphrase 'notasecret'
30
-
31
30
  issuer 'xxxxxxx@developer.gserviceaccount.com'
32
31
 
32
+ # Optional attributes
33
+ application_name 'My Application'
34
+ application_version '1.0.0'
35
+
33
36
  end
34
37
  ```
35
38
 
@@ -50,7 +53,7 @@ Specify a scope in the configuration `initializers/google_directory.rb`.
50
53
 
51
54
  ``` ruby
52
55
  GoogleDirectory.configure do
53
-
56
+
54
57
  use_yaml Rails.root.join('config', 'google_directory.yaml')
55
58
 
56
59
  scope :domain_one do
@@ -13,7 +13,7 @@ module GoogleDirectory
13
13
 
14
14
 
15
15
  @key = Google::APIClient::KeyUtils.load_from_pkcs12(@config.key_file, @config.key_passphrase)
16
- @client = Google::APIClient.new(:application_name => 'Saeko Directory API', :application_version => '1.0.0')
16
+ @client = Google::APIClient.new(:application_name => @config.application_name, :application_version => @config.application_version )
17
17
 
18
18
  @client.authorization = Signet::OAuth2::Client.new(
19
19
  :token_credential_uri => 'https://accounts.google.com/o/oauth2/token',
@@ -26,7 +26,7 @@ module GoogleDirectory
26
26
 
27
27
  if token = @config.load_token
28
28
 
29
- token['issued_at'] = DateTime.parse( token['issued_at'] )
29
+ token['issued_at'] = Time.parse( token['issued_at'] )
30
30
  @client.authorization.update_token!(token)
31
31
 
32
32
  else
@@ -26,10 +26,12 @@ module GoogleDirectory
26
26
 
27
27
  class Config
28
28
 
29
- attr_reader :admin_email, :key_passphrase, :issuer, :key_file, :scope_name
29
+ attr_reader :admin_email, :key_passphrase, :issuer, :key_file, :scope_name, :application_version, :application_name
30
30
 
31
31
  def initialize(scope_name = :main)
32
32
  @scope_name = scope_name
33
+ @application_name = 'Google Directory API'
34
+ @application_version = GoogleDirectory::VERSION
33
35
  end
34
36
 
35
37
  def using(scope)
@@ -92,6 +94,14 @@ module GoogleDirectory
92
94
  @current_config.instance_variable_set('@issuer', issuer)
93
95
  end
94
96
 
97
+ def application_name( application_name )
98
+ @current_config.instance_variable_set('@application_name', application_name)
99
+ end
100
+
101
+ def application_version( application_version )
102
+ @current_config.instance_variable_set('@application_version', application_version)
103
+ end
104
+
95
105
  def scope( scope_name, &block )
96
106
  scopes = @config.instance_variable_get('@scopes')
97
107
  scopes[scope_name] = @current_config = Config.new(scope_name)
@@ -1,3 +1,3 @@
1
1
  module GoogleDirectory
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  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.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Omar Osorio