Skip to content

Commit

Permalink
v1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Hodglim authored Nov 14, 2017
2 parents 0a01937 + 5b4edfe commit 7ae256d
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 5 deletions.
42 changes: 42 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Client
/**
* @var string
*/
const version = '1.4.1';
const version = '1.5.0';

/**
* Client constructor.
Expand Down
2 changes: 1 addition & 1 deletion src/Endpoints/Attendance.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Attendance extends BootstrapEndpoint
/**
* @var string
*/
public $uri = 'attendance/session';
public $uri = 'attendance/session/';

/**
* Session Register
Expand Down
17 changes: 15 additions & 2 deletions src/Endpoints/BootstrapEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}

/**
Expand Down
9 changes: 9 additions & 0 deletions src/Endpoints/EmployeeAbsences.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php namespace Wonde\Endpoints;

class EmployeeAbsences extends BootstrapEndpoint
{
/**
* @var string
*/
public $uri = 'employee-absences/';
}
9 changes: 9 additions & 0 deletions src/Endpoints/GroupsHistorical.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php namespace Wonde\Endpoints;

class GroupsHistorical extends BootstrapEndpoint
{
/**
* @var string
*/
public $uri = 'groups-historical/';
}
2 changes: 1 addition & 1 deletion src/Endpoints/LessonAttendance.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class LessonAttendance extends BootstrapEndpoint
/**
* @var string
*/
public $uri = 'attendance/lesson';
public $uri = 'attendance/lesson/';

/**
* Lesson Register
Expand Down
18 changes: 18 additions & 0 deletions src/Endpoints/Schools.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,21 @@ class Schools extends BootstrapEndpoint
*/
public $employees;

/**
* @var EmployeeAbsences
*/
public $employeeAbsences;

/**
* @var Groups
*/
public $groups;

/**
* @var GroupsHistorical
*/
public $groupsHistorical;

/**
* @var Lessons
*/
Expand Down Expand Up @@ -97,6 +107,11 @@ class Schools extends BootstrapEndpoint
*/
public $students;

/**
* @var StudentsPreAdmission
*/
public $studentsPreAdmission;

/**
* @var Assessment
*/
Expand Down Expand Up @@ -137,8 +152,10 @@ public function __construct($token, $id = false)
$this->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);
Expand All @@ -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);
}

Expand Down
9 changes: 9 additions & 0 deletions src/Endpoints/StudentsPreAdmission.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php namespace Wonde\Endpoints;

class StudentsPreAdmission extends BootstrapEndpoint
{
/**
* @var string
*/
public $uri = 'students-pre-admission/';
}

0 comments on commit 7ae256d

Please sign in to comment.