Class: Nylas::NativeAuthentication
- Inherits:
-
Object
- Object
- Nylas::NativeAuthentication
- Defined in:
- lib/nylas/native_authentication.rb
Overview
Authenticate your application using the native interface
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
Instance Method Summary collapse
- #authenticate(name:, email_address:, provider:, settings:, reauth_account_id: nil, scopes: nil) ⇒ Object
-
#initialize(api:) ⇒ NativeAuthentication
constructor
A new instance of NativeAuthentication.
Constructor Details
#initialize(api:) ⇒ NativeAuthentication
Returns a new instance of NativeAuthentication.
9 10 11 |
# File 'lib/nylas/native_authentication.rb', line 9 def initialize(api:) self.api = api end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
7 8 9 |
# File 'lib/nylas/native_authentication.rb', line 7 def api @api end |
Instance Method Details
#authenticate(name:, email_address:, provider:, settings:, reauth_account_id: nil, scopes: nil) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/nylas/native_authentication.rb', line 13 def authenticate(name:, email_address:, provider:, settings:, reauth_account_id: nil, scopes: nil) scopes ||= %w[email calendar contacts] scopes = scopes.join(",") unless scopes.is_a?(String) code = retrieve_code(name: name, email_address: email_address, provider: provider, settings: settings, reauth_account_id: reauth_account_id, scopes: scopes) exchange_code_for_access_token(code) end |