From c8537d0037a8c773dd2a7c96ef59e6d0ad440b2a Mon Sep 17 00:00:00 2001 From: philipp lang Date: Sat, 10 Apr 2021 00:38:45 +0200 Subject: [PATCH] Add country api --- src/Api.php | 14 ++++++-------- src/Country.php | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 src/Country.php diff --git a/src/Api.php b/src/Api.php index 11a6216..ac07eed 100644 --- a/src/Api.php +++ b/src/Api.php @@ -165,6 +165,12 @@ class Api { }); } + public function countries() { + return collect($this->http()->get(self::$url."/ica/rest/baseadmin/land")['data'])->map(function($country) { + return Country::fromNami($country); + }); + } + public function feesOf($groupid) { return collect($this->http()->get(self::$url."/ica/rest/namiBeitrag/beitragsartmgl/gruppierung/{$groupid}")['data'])->map(function($fee) { return Fee::fromNami($fee); @@ -223,14 +229,6 @@ class Api { return json_decode((string)$response->getBody()); } - public function countries() { - $response = $this->client->get("/ica/rest/baseadmin/land", [ - 'cookies' => $this->cookie - ]); - - return json_decode((string)$response->getBody()); - } - public function groupForActivity($activityId) { $response = $this->client->get("/ica/rest//nami/untergliederungauftaetigkeit/filtered/untergliederung/taetigkeit/{$activityId}", [ diff --git a/src/Country.php b/src/Country.php new file mode 100644 index 0000000..e7dd313 --- /dev/null +++ b/src/Country.php @@ -0,0 +1,19 @@ + $item['id'], + 'name' => $item['descriptor'] + ]); + } + +}