Class: Azure::Directory::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/azure/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.



27
28
29
# File 'lib/azure/directory/config.rb', line 27

def initialize(scope_name = :main)
  @scope_name = scope_name
end

Instance Attribute Details

#client_idObject (readonly)

Returns the value of attribute client_id.



25
26
27
# File 'lib/azure/directory/config.rb', line 25

def client_id
  @client_id
end

#client_secretObject (readonly)

Returns the value of attribute client_secret.



25
26
27
# File 'lib/azure/directory/config.rb', line 25

def client_secret
  @client_secret
end

#resource_idObject (readonly)

Returns the value of attribute resource_id.



25
26
27
# File 'lib/azure/directory/config.rb', line 25

def resource_id
  @resource_id
end

#scope_nameObject (readonly)

Returns the value of attribute scope_name.



25
26
27
# File 'lib/azure/directory/config.rb', line 25

def scope_name
  @scope_name
end

#tenant_idObject (readonly)

Returns the value of attribute tenant_id.



25
26
27
# File 'lib/azure/directory/config.rb', line 25

def tenant_id
  @tenant_id
end

Instance Method Details

#load_tokenObject



41
42
43
# File 'lib/azure/directory/config.rb', line 41

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

#save_token(token_hash) ⇒ Object



36
37
38
39
# File 'lib/azure/directory/config.rb', line 36

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

#using(scope) ⇒ Object



31
32
33
# File 'lib/azure/directory/config.rb', line 31

def using(scope)
  @scopes[scope]
end