FS_Api
Class FS_Api
Description Description
Wraps Freemius API SDK to handle:
- Clock sync.
- Fallback to HTTP when HTTPS fails.
- Adds caching layer to GET requests.
- Adds consistency for failed requests by using last cached version.
Source Source
File: includes/pum-sdk/freemius/includes/class-fs-api.php
Expand full source code Collapse full source code View on Trac
Methods Methods
- __construct
- _call — Override API call to enable retry with servers' clock auto sync method.
- _init
- _sync_clock_diff — Find clock diff between server and API server, and store the diff locally.
- call — Override API call to wrap it in servers' clock sync method.
- clear_cache — Clear API cache.
- get
- get_cache_key
- get_error_code — Get API result error code. If failed to get code, returns an empty string.
- get_signed_url — Get API request URL signed via query string.
- get_temporary_unavailable_error
- get_url
- instance
- is_api_error
- is_api_error_object
- is_api_result_entity — Checks if given API result is a non-empty entity object with non-empty ID.
- is_api_result_object — Checks if given API result is a non-empty and not an error object.
- is_cached — Check if there's a cached version of the API request.
- is_temporary_down — Check if API is temporary down.
- is_valid_ping — Check if valid ping request result.
- ping — Ping API for connectivity test, and return result object.
- purge_cache — Invalidate a cached version of the API request.
- should_try_with_http — Check if based on the API result we should try to re-run the same request with HTTP instead of HTTPS.
- test — Test API connectivity.
- update_cache_expiration — Invalidate a cached version of the API request.