Skip to content

Commit

Permalink
feat: add lineItem collection
Browse files Browse the repository at this point in the history
  • Loading branch information
xchopin committed Dec 9, 2019
1 parent b61e4b9 commit d149c2e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/Model/LineItem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

/**
*
* User entity
*
* @copyright Apereo
* @category OpenLRW
* @package Entity
* @author Xavier Chopin <[email protected]>
* @license http://www.osedu.org/licenses/ECL-2.0 ECL-2.0 License
*/

namespace OpenLRW\Model;

use OpenLRW\Exception\NotFoundException;

class LineItem extends OneRoster
{

protected static $collection = 'lineitems';

protected $fillable = [
'sourcedId',
'status',
'metadata',
'dateLastModified',
'title',
'description',
'assignDate',
'DueDate',
'resultValueMin"',
'resultValueMax',
'class',
'category',
];

/**
* Override due to lineItem json structure (contains a lineItem array)
* @param $id
* @return OneRoster
*/
public static function find($id){
$lineItem = parent::httpGet(static::$collection . "/$id");
return $lineItem->lineItem;
}
}
5 changes: 5 additions & 0 deletions src/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ public static function eventsFromTo(String $id, String $from, String $to)
return parent::httpGet(static::$collection . "/$id/events?from=$from&to=$to");
}

public static function results(String $id)
{
return parent::httpGet(static::$collection . "/$id/results");
}

}

0 comments on commit d149c2e

Please sign in to comment.