From c2d06b7bdb06e90ea38d431eb05394c41fdfd079 Mon Sep 17 00:00:00 2001 From: Surfoo Date: Sat, 19 Mar 2022 23:58:24 +0100 Subject: [PATCH] version 3.18.0 --- .travis.yml | 26 +++++++++++++-- CHANGELOG => CHANGELOG.md | 11 +++++++ composer.json | 4 +-- src/Lib/Utils/Utils.php | 2 +- src/Sdk/GeocachingSdk.php | 52 ++++++++++++++++++++++-------- src/Sdk/GeocachingSdkInterface.php | 28 ++++++++++++---- 6 files changed, 97 insertions(+), 26 deletions(-) rename CHANGELOG => CHANGELOG.md (84%) diff --git a/.travis.yml b/.travis.yml index bbfaa5f..aac35fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,13 +3,33 @@ php: - 7.3 - 7.4 - 8.0 + - 8.1 env: -# - dependencies=--prefer-lowest - dependencies= script: ./vendor/bin/phpunit --coverage-text +matrix: + include: + - php: 7.3 + env: dependencies=lowest + - php: 7.3 + env: dependencies=highest + - php: 7.4 + env: dependencies=lowest + - php: 7.4 + env: dependencies=highest + - php: 8.0 + env: dependencies=lowest + - php: 8.0 + env: dependencies=highest + - php: 8.1 + env: dependencies=lowest + - php: 8.1 + env: dependencies=highest + before_script: - - composer self-update - - composer update + - if [ -z "$dependencies" ]; then composer install -n; fi; + - if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest --prefer-stable -n; fi; + - if [ "$dependencies" = "highest" ]; then composer update -n; fi; diff --git a/CHANGELOG b/CHANGELOG.md similarity index 84% rename from CHANGELOG rename to CHANGELOG.md index dba12f7..0601840 100644 --- a/CHANGELOG +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.18.0] - 2021-03-24 +### Added + - Compatibility with PHP 8.1 + - New API method added: + - getUserPrivacySettings + - getAdventure + +## [3.16.0] - 2021-08-06 +### Added + - Better exception management + ## [3.15.0] - 2021-05-22 ### Added - New API method added: diff --git a/composer.json b/composer.json index fcf9815..9ff4e5d 100644 --- a/composer.json +++ b/composer.json @@ -17,14 +17,14 @@ } }, "require": { - "php": "^7.3 || ^8.0", + "php": "^7.3 || ^8.0 || ^8.1", "monolog/monolog": "^2.0", "guzzlehttp/guzzle": "^7.0", "surfoo/oauth2-geocaching": "^1.4" }, "require-dev": { "phpunit/phpunit": "^9.0", - "phpstan/phpstan": "^0.12.0", + "phpstan/phpstan": "^0.12", "friendsofphp/php-cs-fixer": "^3.0" }, "scripts": { diff --git a/src/Lib/Utils/Utils.php b/src/Lib/Utils/Utils.php index 226a281..4e59985 100644 --- a/src/Lib/Utils/Utils.php +++ b/src/Lib/Utils/Utils.php @@ -134,7 +134,7 @@ protected static function base31Encode(int $input): string while ($input > 0) { $result .= self::BASE_31_CHARS[$input % 31]; - $input = (int) $input / 31; + $input = intval($input / 31); } return \strrev($result); diff --git a/src/Sdk/GeocachingSdk.php b/src/Sdk/GeocachingSdk.php index f2294b9..eb7f14d 100644 --- a/src/Sdk/GeocachingSdk.php +++ b/src/Sdk/GeocachingSdk.php @@ -30,6 +30,19 @@ public function __construct(HttpClientInterface $httpClient) $this->httpClient = $httpClient; } + /** + * swagger: GET /v{api-version}/adventures/{adventureId} + * + * @see https://api.groundspeak.com/documentation#get-adventure + * @see https://api.groundspeak.com/api-docs/index#!/Adventures/Adventures_Get + * + * @return \Geocaching\Lib\Adapters\GuzzleHttpClient + */ + public function getAdventure(string $adventureId, array $options = []) + { + return $this->httpClient->get('adventures/' . $adventureId, [], $options); + } + /** * swagger: GET /v{api-version}/adventures/search * @@ -851,6 +864,19 @@ public function getTrackableLogs(string $referenceCode, array $query = [], array return $this->httpClient->get('trackables/' . $referenceCode . '/trackablelogs', $query, $options); } + /** + * swagger: GET /v{api-version}/users/{referenceCode}/privacysettings + * + * @see https://api.groundspeak.com/documentation#get-user-privacy-settings + * @see https://api.groundspeak.com/api-docs/index#!/Users/Users_GetUserPrivacySettings + * + * @return \Geocaching\Lib\Adapters\GuzzleHttpClient + */ + public function getUserPrivacySettings(string $referenceCode, array $options = []) + { + return $this->httpClient->get('users/' . $referenceCode . '/privacysettings', [], $options); + } + /** * swagger: GET /v{api-version}/users/{referenceCode} * @@ -864,6 +890,19 @@ public function getUser(string $referenceCode, array $query = [], array $options return $this->httpClient->get('users/' . $referenceCode, $query, $options); } + /** + * swagger: GET /v{api-version}/optedoutusers + * + * @see https://api.groundspeak.com/documentation#get-opted-out-users + * @see https://api.groundspeak.com/api-docs/index#!/Users/Users_GetOptedOutUsers + * + * @return \Geocaching\Lib\Adapters\GuzzleHttpClient + */ + public function getOptedOutUsers(array $query, array $options = []) + { + return $this->httpClient->get('optedoutusers', $query, $options); + } + /** * swagger: GET /v{api-version}/users/{referenceCode}/images * @@ -1163,19 +1202,6 @@ public function getTrackableLogTypes(array $options = []) return $this->httpClient->get('trackablelogtypes', $options); } - /** - * swagger: GET /v{api-version}/optedoutusers - * - * @see https://api.groundspeak.com/documentation#get-opted-out-users - * @see https://api.groundspeak.com/api-docs/index#!/Users/Users_GetOptedOutUsers - * - * @return \Geocaching\Lib\Adapters\GuzzleHttpClient - */ - public function getOptedOutUsers(array $query, array $options = []) - { - return $this->httpClient->get('optedoutusers', $query, $options); - } - /** * swagger: GET /v{api-version}/wherigo/{guid}/cartridge * diff --git a/src/Sdk/GeocachingSdkInterface.php b/src/Sdk/GeocachingSdkInterface.php index 3b5a06f..37783f7 100644 --- a/src/Sdk/GeocachingSdkInterface.php +++ b/src/Sdk/GeocachingSdkInterface.php @@ -12,6 +12,13 @@ interface GeocachingSdkInterface { + /** + * @see https://api.groundspeak.com/api-docs/index#!/Adventures/Adventures_Get + * + * @return \Geocaching\Lib\Adapters\GuzzleHttpClient + */ + public function getAdventure(string $adventureId, array $options = []); + /** * @see https://api.groundspeak.com/api-docs/index#!/Adventures/Adventures_Search * @@ -451,6 +458,13 @@ public function getTrackableImages(string $referenceCode, array $query = [], arr */ public function getTrackableLogs(string $referenceCode, array $query = [], array $options = []); + /** + * @see https://api.groundspeak.com/documentation#get-user-privacy-settings + * + * @return \Geocaching\Lib\Adapters\GuzzleHttpClient + */ + public function getUserPrivacySettings(string $referenceCode, array $options = []); + /** * @see https://api.groundspeak.com/documentation#get-user * @@ -458,6 +472,13 @@ public function getTrackableLogs(string $referenceCode, array $query = [], array */ public function getUser(string $referenceCode, array $query = [], array $options = []); + /** + * @see https://api.groundspeak.com/documentation#get-opted-out-users + * + * @return \Geocaching\Lib\Adapters\GuzzleHttpClient + */ + public function getOptedOutUsers(array $query, array $options = []); + /** * @see https://api.groundspeak.com/documentation#get-user-images * @@ -619,13 +640,6 @@ public function getGeocacheLogTypes(array $options = []); */ public function getTrackableLogTypes(array $options = []); - /** - * @see https://api.groundspeak.com/documentation#get-opted-out-users - * - * @return \Geocaching\Lib\Adapters\GuzzleHttpClient - */ - public function getOptedOutUsers(array $query, array $options = []); - /** * @return \Geocaching\Lib\Adapters\GuzzleHttpClient */