Class: Office365::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/office365/client.rb

Direct Known Subclasses

REST::Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ Office365::Client

Initializes a new Client object

Parameters:

  • options (Hash) (defaults to: {})

Yields:

  • (_self)

Yield Parameters:



11
12
13
14
15
16
# File 'lib/office365/client.rb', line 11

def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
  yield(self) if block_given?
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



5
6
7
# File 'lib/office365/client.rb', line 5

def access_token
  @access_token
end

#client_idObject

Returns the value of attribute client_id.



5
6
7
# File 'lib/office365/client.rb', line 5

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



5
6
7
# File 'lib/office365/client.rb', line 5

def client_secret
  @client_secret
end

#debugObject

Returns the value of attribute debug.



5
6
7
# File 'lib/office365/client.rb', line 5

def debug
  @debug
end

#redirect_uriObject

Returns the value of attribute redirect_uri.



5
6
7
# File 'lib/office365/client.rb', line 5

def redirect_uri
  @redirect_uri
end

#refresh_tokenObject

Returns the value of attribute refresh_token.



5
6
7
# File 'lib/office365/client.rb', line 5

def refresh_token
  @refresh_token
end

#tenant_idObject

Returns the value of attribute tenant_id.



5
6
7
# File 'lib/office365/client.rb', line 5

def tenant_id
  @tenant_id
end

Instance Method Details

#credentialsHash

Returns:



24
25
26
27
28
29
30
31
# File 'lib/office365/client.rb', line 24

def credentials
  {
    client_id: client_id,
    client_secret: client_secret,
    access_token: access_token,
    refresh_token: refresh_token
  }
end

#credentials?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/office365/client.rb', line 34

def credentials?
  credentials.values.none? { |v| blank_string?(v) }
end

#user_token?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/office365/client.rb', line 19

def user_token?
  !(blank_string?(access_token) || blank_string?(refresh_token))
end