Skip to content

Commit d149c2e

Browse files
committed
feat: add lineItem collection
1 parent b61e4b9 commit d149c2e

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

src/Model/LineItem.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/**
4+
*
5+
* User entity
6+
*
7+
* @copyright Apereo
8+
* @category OpenLRW
9+
* @package Entity
10+
* @author Xavier Chopin <[email protected]>
11+
* @license http://www.osedu.org/licenses/ECL-2.0 ECL-2.0 License
12+
*/
13+
14+
namespace OpenLRW\Model;
15+
16+
use OpenLRW\Exception\NotFoundException;
17+
18+
class LineItem extends OneRoster
19+
{
20+
21+
protected static $collection = 'lineitems';
22+
23+
protected $fillable = [
24+
'sourcedId',
25+
'status',
26+
'metadata',
27+
'dateLastModified',
28+
'title',
29+
'description',
30+
'assignDate',
31+
'DueDate',
32+
'resultValueMin"',
33+
'resultValueMax',
34+
'class',
35+
'category',
36+
];
37+
38+
/**
39+
* Override due to lineItem json structure (contains a lineItem array)
40+
* @param $id
41+
* @return OneRoster
42+
*/
43+
public static function find($id){
44+
$lineItem = parent::httpGet(static::$collection . "/$id");
45+
return $lineItem->lineItem;
46+
}
47+
}

src/Model/User.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,9 @@ public static function eventsFromTo(String $id, String $from, String $to)
6060
return parent::httpGet(static::$collection . "/$id/events?from=$from&to=$to");
6161
}
6262

63+
public static function results(String $id)
64+
{
65+
return parent::httpGet(static::$collection . "/$id/results");
66+
}
67+
6368
}

0 commit comments

Comments
 (0)