| @@ -11,9 +11,9 @@ | ||
| 11 | 11 | * ConvertKit Posts data stored locally from the API. |
| 12 | 12 | * |
| 13 | 13 | * @since 1.9.7.4 |
| 14 | 14 | */ |
| 15 | -class ConvertKit_Resource_Posts extends ConvertKit_Resource { | |
| 15 | +class ConvertKit_Resource_Posts extends ConvertKit_Resource_V4 { | |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Holds the Settings Key that stores site wide ConvertKit settings |
| 19 | 19 | * |
| @@ -73,14 +73,16 @@ | ||
| 73 | 73 | * @param bool|string $context Context. |
| 74 | 74 | */ |
| 75 | 75 | public function __construct( $context = false ) { |
| 76 | 76 | |
| 77 | - // Initialize the API if the API Key and Secret have been defined in the Plugin Settings. | |
| 77 | + // Initialize the API if the Access Token has been defined in the Plugin Settings. | |
| 78 | 78 | $settings = new ConvertKit_Settings(); |
| 79 | - if ( $settings->has_api_key_and_secret() ) { | |
| 80 | - $this->api = new ConvertKit_API( | |
| 81 | - $settings->get_api_key(), | |
| 82 | - $settings->get_api_secret(), | |
| 79 | + if ( $settings->has_access_and_refresh_token() ) { | |
| 80 | + $this->api = new ConvertKit_API_V4( | |
| 81 | + CONVERTKIT_OAUTH_CLIENT_ID, | |
| 82 | + CONVERTKIT_OAUTH_CLIENT_REDIRECT_URI, | |
| 83 | + $settings->get_access_token(), | |
| 84 | + $settings->get_refresh_token(), | |
| 83 | 85 | $settings->debug_enabled(), |
| 84 | 86 | $context |
| 85 | 87 | ); |
| 86 | 88 | } |