Class: OSA::Context
- Inherits:
-
Object
- Object
- OSA::Context
- Defined in:
- lib/osa/util/context.rb
Instance Attribute Summary collapse
-
#auth_service ⇒ Object
readonly
Returns the value of attribute auth_service.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#graph_client ⇒ Object
readonly
Returns the value of attribute graph_client.
Instance Method Summary collapse
-
#initialize(config = nil) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(config = nil) ⇒ Context
Returns a new instance of Context.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/osa/util/context.rb', line 13 def initialize(config = nil) @config = config || Config.first if @config.nil? $stderr.puts 'OSA not configured' exit 1 end auth_client = MSAuthClient.new @auth_service = AuthService.new(auth_client) token = auth_service.refresh_token(@config) @graph_client = MSGraphClient.new(token['access_token']) end |
Instance Attribute Details
#auth_service ⇒ Object (readonly)
Returns the value of attribute auth_service.
10 11 12 |
# File 'lib/osa/util/context.rb', line 10 def auth_service @auth_service end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/osa/util/context.rb', line 11 def config @config end |
#graph_client ⇒ Object (readonly)
Returns the value of attribute graph_client.
9 10 11 |
# File 'lib/osa/util/context.rb', line 9 def graph_client @graph_client end |