Skip to content

Commit

Permalink
chore: remove fivetran
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelpeixe committed Jan 30, 2025
1 parent ed4c44a commit a38eeac
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 225 deletions.
1 change: 0 additions & 1 deletion includes/class-newspack.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ private function includes() {
include_once NEWSPACK_ABSPATH . 'includes/oauth/class-google-oauth.php';
include_once NEWSPACK_ABSPATH . 'includes/oauth/class-google-services-connection.php';
include_once NEWSPACK_ABSPATH . 'includes/oauth/class-mailchimp-api.php';
include_once NEWSPACK_ABSPATH . 'includes/oauth/class-fivetran-connection.php';
include_once NEWSPACK_ABSPATH . 'includes/oauth/class-google-login.php';
include_once NEWSPACK_ABSPATH . 'includes/class-blocks.php';
include_once NEWSPACK_ABSPATH . 'includes/tracking/class-pixel.php';
Expand Down
193 changes: 0 additions & 193 deletions includes/oauth/class-fivetran-connection.php

This file was deleted.

14 changes: 3 additions & 11 deletions includes/oauth/class-oauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static function retrieve_csrf_token( $namespace ) {
/**
* Process OAuth proxy URL.
*
* @param string $type 'google' or 'fivetran' for now.
* @param string $type 'google' for now.
* @param string $path Path to append to base URL.
* @param array $query_args Query params.
* @throws \Exception If trying to authenticate a non-existent proxy.
Expand All @@ -103,7 +103,7 @@ public static function authenticate_proxy_url( string $type, string $path = '',
/**
* Is OAuth2 configured for this instance?
*
* @param string $type 'google' or 'fivetran' for now.
* @param string $type 'google' for now.
*/
public static function is_proxy_configured( $type ) {
return self::get_proxy_url( $type ) && self::get_proxy_api_key();
Expand All @@ -112,7 +112,7 @@ public static function is_proxy_configured( $type ) {
/**
* Get proxy URL by type.
*
* @param string $type 'google' or 'fivetran' for now.
* @param string $type 'google' for now.
*/
private static function get_proxy_url( $type ) {
switch ( $type ) {
Expand All @@ -124,14 +124,6 @@ private static function get_proxy_url( $type ) {
return NEWSPACK_GOOGLE_OAUTH_PROXY;
}
break;
case 'fivetran':
if ( defined( 'NEWSPACK_FIVETRAN_PROXY_OVERRIDE' ) ) {
return NEWSPACK_FIVETRAN_PROXY_OVERRIDE;
}
if ( defined( 'NEWSPACK_FIVETRAN_PROXY' ) ) {
return NEWSPACK_FIVETRAN_PROXY;
}
break;
}
return false;
}
Expand Down
20 changes: 0 additions & 20 deletions tests/unit-tests/oauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,24 +129,4 @@ public function test_oauth_google() {
'OAuth2 object getter return false after credentials are removed.'
);
}

/**
* Fivetran OAuth flow.
*/
public function test_oauth_fivetran() {
self::expectException( Exception::class );
self::assertFalse(
OAuth::authenticate_proxy_url( 'fivetran', '/wp-json/newspack-fivetran' ),
'Proxy URL getting throws until configured.'
);
self::set_api_key();
if ( ! defined( 'NEWSPACK_FIVETRAN_PROXY' ) ) {
define( 'NEWSPACK_FIVETRAN_PROXY', 'http://dummy.proxy' );
}
self::assertEquals(
'http://dummy.proxy/wp-json/newspack-fivetran?api_key=123abc',
OAuth::authenticate_proxy_url( 'fivetran', '/wp-json/newspack-fivetran' ),
'Proxy URL is as expected after proxy is configured.'
);
}
}

0 comments on commit a38eeac

Please sign in to comment.