Skip to content

Commit

Permalink
Minor adjustements.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lasering committed Jan 27, 2021
1 parent e67f8d2 commit c50a8a7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/scala/org/fenixedu/sdk/FenixEduClient.scala
Expand Up @@ -4,9 +4,10 @@ import cats.effect.Concurrent
import org.fenixedu.sdk.models.{Course => _, _}
import org.fenixedu.sdk.services._
import org.http4s.Uri
import org.http4s.syntax.literals._
import org.http4s.client.Client

class FenixEduClient[F[_]](val baseUri: Uri)(implicit client: Client[F], F: Concurrent[F]) {
class FenixEduClient[F[_]](val baseUri: Uri = uri"https://fenix.tecnico.ulisboa.pt/api/fenix")(implicit client: Client[F], F: Concurrent[F]) {
val uri: Uri = baseUri / "v1"

/** @return returns some basic information about the institution where the application is deployed.
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/org/fenixedu/sdk/models/Course.scala
Expand Up @@ -40,5 +40,5 @@ object CourseRef {
implicit val decoder: Decoder[CourseRef] = deriveDecoder(identity)
}
case class CourseRef(id: String, acronym: String, name: String, academicTerm: String, url: Option[Uri]) {
def course[F[_]](implicit client: FenixEduClient[F]): F[Course] = client.course(id).get()
def course[F[_]](implicit client: FenixEduClient[F]): F[Course] = client.course(id).model
}
2 changes: 1 addition & 1 deletion src/main/scala/org/fenixedu/sdk/services/Course.scala
Expand Up @@ -13,7 +13,7 @@ final class Course[F[_]: Concurrent](val id: String, baseUri: Uri)(implicit clie
* The same course may be lectured simultaneously in multiple degrees during the same academic term.
* The “competences” field holds curricular information for each set of degrees in which the course is lectured.
* Usually this information is the same for all the associated degrees. */
def get(): F[CouseModel] = client.expect(uri)
val model: F[CouseModel] = client.expect(uri)

/** An evaluation is a component of a course in which the teacher determines the extent of the students understanding of the program.
* Current known implementations of evaluations are: tests, exams, projects, online tests and ad-hoc evaluations. */
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/org/fenixedu/sdk/CoursesSpec.scala
Expand Up @@ -17,7 +17,7 @@ class CoursesSpec extends Utils {
courses.foreach { courseRef =>
val courseService = client.course(courseRef.id)
s"get the course ${courseRef.acronym} (${courseRef.id})" in {
courseService.get().value(_.academicTerm should include (academicTerm))
courseService.model.value(_.academicTerm should include (academicTerm))
}
s"get the course ${courseRef.acronym} (${courseRef.id}) evaluations" in {
courseService.evaluations.value(_.length should be >= 0)
Expand Down

0 comments on commit c50a8a7

Please sign in to comment.