Class: Webhookdb::Oauth::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/webhookdb/oauth.rb

Overview

rubocop:disable Lint/UnusedMethodArgument

Direct Known Subclasses

FrontProvider, IntercomProvider

Instance Method Summary collapse

Instance Method Details

#app_nameString

Returns Name of the app to present to users.

Returns:

  • (String)

    Name of the app to present to users.

Raises:

  • (NotImplementedError)


20
# File 'lib/webhookdb/oauth.rb', line 20

def app_name = raise NotImplementedError

#authorization_url(state:) ⇒ String

Returns The Oauth URL to send users to to begin OAuth.

Returns:

  • (String)

    The Oauth URL to send users to to begin OAuth.

Raises:

  • (NotImplementedError)


36
# File 'lib/webhookdb/oauth.rb', line 36

def authorization_url(state:) = raise NotImplementedError

#build_marketplace_integrations(organization:, tokens:, scope:) ⇒ Object

Create the actual service integrations for the given org. # @param scope [Hash]

Parameters:

Raises:

  • (NotImplementedError)


54
# File 'lib/webhookdb/oauth.rb', line 54

def build_marketplace_integrations(organization:, tokens:, scope:) = raise NotImplementedError

#exchange_authorization_code(code:) ⇒ Webhookdb::Oauth::Tokens

Exchange the access code (from the authorization url) for access and/or refresh tokens.

Returns:

Raises:

  • (NotImplementedError)


40
# File 'lib/webhookdb/oauth.rb', line 40

def exchange_authorization_code(code:) = raise NotImplementedError

#find_or_create_customer(tokens:, scope:) ⇒ Array{TrueClass, FalseClass, Webhookdb::Customer}

Parameters:

  • tokens (Webhookdb::Oauth::Tokens)
  • scope (Hash)

    Used to store data needed in later calls, like when building integrations.

Returns:

Raises:

  • (NotImplementedError)


45
46
47
48
# File 'lib/webhookdb/oauth.rb', line 45

def find_or_create_customer(tokens:, scope:)
  raise RuntimeError("should not be called") if self.requires_webhookdb_auth?
  raise NotImplementedError
end

#keyString

Returns Unique key to identify the provider.

Returns:

  • (String)

    Unique key to identify the provider.

Raises:

  • (NotImplementedError)


17
# File 'lib/webhookdb/oauth.rb', line 17

def key = raise NotImplementedError

#requires_webhookdb_auth?Boolean

True if auth with this provider requires the user auth in WebhookDB, false if we can get their email from the Oauth process. If the access token can be used to get the ‘me’ user, we can usually use their email for the customer, but this may not be possible for some integrations.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


27
# File 'lib/webhookdb/oauth.rb', line 27

def requires_webhookdb_auth? = raise NotImplementedError

#supports_webhooks?Boolean

This is similar to ‘supports_webhooks` in the Replicator descriptors, except that this is used to make the success page dynamic. True if this provider’s integrations support webhooks (real-time or user-built webhook payloads).

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


33
# File 'lib/webhookdb/oauth.rb', line 33

def supports_webhooks? = raise NotImplementedError