Class: Webhookdb::Oauth::FakeProvider

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

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.exchange_authorization_codeObject

If any of these are non-nil, they’re called instead of the instance method.



8
9
10
# File 'lib/webhookdb/oauth/fake_provider.rb', line 8

def exchange_authorization_code
  @exchange_authorization_code
end

.supports_webhooksObject

If any of these are non-nil, they’re called instead of the instance method.



8
9
10
# File 'lib/webhookdb/oauth/fake_provider.rb', line 8

def supports_webhooks
  @supports_webhooks
end

Class Method Details

.resetObject



10
11
12
13
# File 'lib/webhookdb/oauth/fake_provider.rb', line 10

def reset
  self.supports_webhooks = nil
  self.exchange_authorization_code = nil
end

Instance Method Details

#app_nameObject



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

def app_name = "Fake"

#authorization_url(state:) ⇒ Object



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

def authorization_url(state:)
  return "#{Webhookdb.api_url}/v1/install/fake_oauth_authorization?client_id=fakeclient&state=#{state}"
end

#build_marketplace_integrations(organization:, tokens:) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/webhookdb/oauth/fake_provider.rb', line 30

def build_marketplace_integrations(organization:, tokens:, **)
  return Webhookdb::ServiceIntegration.create_disambiguated(
    "fake_v1",
    organization:,
    webhook_secret: tokens.access_token,
    backfill_key: tokens.refresh_token,
  )
end

#exchange_authorization_code(code:) ⇒ Object



24
25
26
27
28
# File 'lib/webhookdb/oauth/fake_provider.rb', line 24

def exchange_authorization_code(code:)
  return _call_or_do(:exchange_authorization_code) do
    Webhookdb::Oauth::Tokens.new(access_token: "access-#{code}", refresh_token: "refresh-#{code}")
  end
end

#keyObject



16
# File 'lib/webhookdb/oauth/fake_provider.rb', line 16

def key = "fake"

#supports_webhooks?Boolean

Returns:

  • (Boolean)


18
# File 'lib/webhookdb/oauth/fake_provider.rb', line 18

def supports_webhooks? = _call_or_do(:supports_webhooks) { true }