Class: Webhookdb::Oauth::FakeProvider
- Defined in:
- lib/webhookdb/oauth/fake_provider.rb
Class Attribute Summary collapse
-
.exchange_authorization_code ⇒ Object
If any of these are non-nil, they’re called instead of the instance method.
-
.supports_webhooks ⇒ Object
If any of these are non-nil, they’re called instead of the instance method.
Class Method Summary collapse
Instance Method Summary collapse
- #app_name ⇒ Object
- #authorization_url(state:) ⇒ Object
- #build_marketplace_integrations(organization:, tokens:) ⇒ Object
- #exchange_authorization_code(code:) ⇒ Object
- #key ⇒ Object
- #supports_webhooks? ⇒ Boolean
Class Attribute Details
.exchange_authorization_code ⇒ Object
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 end |
.supports_webhooks ⇒ Object
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
.reset ⇒ Object
10 11 12 13 |
# File 'lib/webhookdb/oauth/fake_provider.rb', line 10 def reset self.supports_webhooks = nil self. = nil end |
Instance Method Details
#app_name ⇒ Object
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 (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 (code:) return _call_or_do(:exchange_authorization_code) do Webhookdb::Oauth::Tokens.new(access_token: "access-#{code}", refresh_token: "refresh-#{code}") end end |
#key ⇒ Object
16 |
# File 'lib/webhookdb/oauth/fake_provider.rb', line 16 def key = "fake" |
#supports_webhooks? ⇒ Boolean
18 |
# File 'lib/webhookdb/oauth/fake_provider.rb', line 18 def supports_webhooks? = _call_or_do(:supports_webhooks) { true } |