diff --git a/readme.md b/readme.md index 51007d8..8976355 100644 --- a/readme.md +++ b/readme.md @@ -133,6 +133,22 @@ foreach ($school->students->all(['contact_details', 'extended_details'], ['updat } ``` +### Pre Admission Students + +```php +$client = new \Wonde\Client('TOKEN_GOES_HERE'); + +$school = $client->school('SCHOOL_ID_GOES_HERE'); + +// Get students +foreach ($school->studentsPreAdmission->all() as $studentPreAdmission) { + echo $studentPreAdmission->forename . ' ' . $studentPreAdmission->surname . PHP_EOL; +} + +// Get single student +$student = $school->studentsPreAdmission->get('STUDENT_ID_GOES_HERE'); +``` + ### Achievements ```php @@ -439,6 +455,19 @@ foreach ($school->employees->all() as $employee) { } ``` +### Employee Absencess + +```php +$client = new \Wonde\Client('TOKEN_GOES_HERE'); + +$school = $client->school('SCHOOL_ID_GOES_HERE'); + +// Get employee absencess +foreach ($school->employeeAbsences->all() as $employeeAbsence) { + echo $employeeAbsence->employee . ' ' . $employeeAbsence->absence_type . PHP_EOL; +} +``` + ### Events ```php @@ -465,6 +494,19 @@ foreach ($school->groups->all() as $group) { } ``` +### Historical Groups + +```php +$client = new \Wonde\Client('TOKEN_GOES_HERE'); + +$school = $client->school('SCHOOL_ID_GOES_HERE'); + +// Get groups +foreach ($school->groupsHistorical->all() as $historicalGroup) { + echo $historicalGroup->name . PHP_EOL; +} +``` + ### Lessons ```php diff --git a/src/Client.php b/src/Client.php index d9e0682..8d42f04 100644 --- a/src/Client.php +++ b/src/Client.php @@ -23,7 +23,7 @@ class Client /** * @var string */ - const version = '1.4.1'; + const version = '1.5.0'; /** * Client constructor. diff --git a/src/Endpoints/Attendance.php b/src/Endpoints/Attendance.php index 4ee62fe..3b1ffee 100644 --- a/src/Endpoints/Attendance.php +++ b/src/Endpoints/Attendance.php @@ -7,7 +7,7 @@ class Attendance extends BootstrapEndpoint /** * @var string */ - public $uri = 'attendance/session'; + public $uri = 'attendance/session/'; /** * Session Register diff --git a/src/Endpoints/BootstrapEndpoint.php b/src/Endpoints/BootstrapEndpoint.php index 7380bef..ba70aa8 100644 --- a/src/Endpoints/BootstrapEndpoint.php +++ b/src/Endpoints/BootstrapEndpoint.php @@ -125,12 +125,25 @@ public function getUrl($url) } /** - * Get single resource + * Get single resource, data only * * @param $id * @return mixed */ public function get($id, $includes = [], $parameters = []) + { + $decoded = $this->getWithMeta($id, $includes, $parameters); + + return $decoded->data; + } + + /** + * Get single resource, data and meta + * + * @param $id + * @return mixed + */ + public function getWithMeta($id, $includes = [], $parameters = []) { if ( ! empty($includes)) { $parameters['include'] = implode(',', $includes); @@ -141,7 +154,7 @@ public function get($id, $includes = [], $parameters = []) $response = $this->getRequest($uri)->getBody()->getContents(); $decoded = json_decode($response); - return $decoded->data; + return $decoded; } /** diff --git a/src/Endpoints/EmployeeAbsences.php b/src/Endpoints/EmployeeAbsences.php new file mode 100644 index 0000000..6ce2d65 --- /dev/null +++ b/src/Endpoints/EmployeeAbsences.php @@ -0,0 +1,9 @@ +counts = new Counts($token, $this->uri); $this->deletions = new Deletions($token, $this->uri); $this->employees = new Employees($token, $this->uri); + $this->employeeAbsences = new EmployeeAbsences($token, $this->uri); $this->events = new Events($token, $this->uri); $this->groups = new Groups($token, $this->uri); + $this->groupsHistorical = new GroupsHistorical($token, $this->uri); $this->lessons = new Lessons($token, $this->uri); $this->lessonAttendance = new LessonAttendance($token, $this->uri); $this->medicalConditions = new MedicalConditions($token, $this->uri); @@ -147,6 +164,7 @@ public function __construct($token, $id = false) $this->photos = new Photos($token, $this->uri); $this->rooms = new Rooms($token, $this->uri); $this->students = new Students($token, $this->uri); + $this->studentsPreAdmission = new StudentsPreAdmission($token, $this->uri); $this->subjects = new Subjects($token, $this->uri); } diff --git a/src/Endpoints/StudentsPreAdmission.php b/src/Endpoints/StudentsPreAdmission.php new file mode 100644 index 0000000..1431625 --- /dev/null +++ b/src/Endpoints/StudentsPreAdmission.php @@ -0,0 +1,9 @@ +