Class: GoogleDirectory::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/google-directory/config.rb

Defined Under Namespace

Classes: Builder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope_name = :main) ⇒ Config

Returns a new instance of Config.



31
32
33
34
35
# File 'lib/google-directory/config.rb', line 31

def initialize(scope_name = :main)
	@scope_name = scope_name
	@application_name = 'Google Directory API'
	@application_version = GoogleDirectory::VERSION
end

Instance Attribute Details

#admin_emailObject (readonly)

Returns the value of attribute admin_email.



29
30
31
# File 'lib/google-directory/config.rb', line 29

def admin_email
  @admin_email
end

#application_nameObject (readonly)

Returns the value of attribute application_name.



29
30
31
# File 'lib/google-directory/config.rb', line 29

def application_name
  @application_name
end

#application_versionObject (readonly)

Returns the value of attribute application_version.



29
30
31
# File 'lib/google-directory/config.rb', line 29

def application_version
  @application_version
end

#issuerObject (readonly)

Returns the value of attribute issuer.



29
30
31
# File 'lib/google-directory/config.rb', line 29

def issuer
  @issuer
end

#key_fileObject (readonly)

Returns the value of attribute key_file.



29
30
31
# File 'lib/google-directory/config.rb', line 29

def key_file
  @key_file
end

#key_passphraseObject (readonly)

Returns the value of attribute key_passphrase.



29
30
31
# File 'lib/google-directory/config.rb', line 29

def key_passphrase
  @key_passphrase
end

#scope_nameObject (readonly)

Returns the value of attribute scope_name.



29
30
31
# File 'lib/google-directory/config.rb', line 29

def scope_name
  @scope_name
end

Instance Method Details

#load_tokenObject



52
53
54
# File 'lib/google-directory/config.rb', line 52

def load_token
	@token_store and @token_store.load(@scope_name)
end

#save_token(token_hash) ⇒ Object

token_type: issued_at: access_token: expires_in:



47
48
49
50
# File 'lib/google-directory/config.rb', line 47

def save_token(token_hash)
	token_hash = token_hash.slice('token_type', 'issued_at', 'access_token', 'expires_in')
	@token_store and @token_store.save(@scope_name, token_hash)
end

#using(scope) ⇒ Object



37
38
39
# File 'lib/google-directory/config.rb', line 37

def using(scope)
	@scopes[scope]
end