Class: SlsAdf::Query

Inherits:
Base
  • Object
show all
Defined in:
lib/sls_adf/query.rb

Overview

Make GraphQL query calls to SLS ADF through Ruby methods.

Sample Usage:

response = SlsAdf::Query.user('User-1234')

Class Method Summary collapse

Class Method Details

.assignment(uuid) ⇒ GraphQL::Client::Response

Query the information of the assignment with the given UUID.

Parameters:

  • uuid (String)

    UUID of the assignment.

Returns:

  • (GraphQL::Client::Response)

    Response of GraphQL call.



41
42
43
# File 'lib/sls_adf/query.rb', line 41

def assignment(uuid)
  execute_query(SlsAdf::Template::Query::Assignment, uuid: uuid)
end

.context(uuid) ⇒ GraphQL::Client::Response

Query the information of the context token provided.

Parameters:

  • uuid (String)

    Context token provided through loading of the application.

Returns:

  • (GraphQL::Client::Response)

    Response of GraphQL call.



16
17
18
# File 'lib/sls_adf/query.rb', line 16

def context(uuid)
  execute_query(SlsAdf::Template::Query::Context, uuid: uuid)
end

.subject_group(uuid) ⇒ GraphQL::Client::Response

Query the information of the subject group with the given UUID.

Parameters:

  • uuid (String)

    UUID of the subject group.

Returns:

  • (GraphQL::Client::Response)

    Response of GraphQL call.



32
33
34
35
# File 'lib/sls_adf/query.rb', line 32

def subject_group(uuid)
  execute_query(SlsAdf::Template::Query::SubjectGroup,
                uuid: uuid, first_student: 45, first_teacher: 30)
end

.task(uuid) ⇒ GraphQL::Client::Response

Query the information of the task with the given UUID.

Parameters:

  • uuid (String)

    UUID of the task.

Returns:

  • (GraphQL::Client::Response)

    Response of GraphQL call.



49
50
51
# File 'lib/sls_adf/query.rb', line 49

def task(uuid)
  execute_query(SlsAdf::Template::Query::Task, uuid: uuid)
end

.user(id) ⇒ GraphQL::Client::Response

Query the information of the user with the given ID.

Parameters:

  • id (String)

    ID of the given user.

Returns:

  • (GraphQL::Client::Response)

    Response of GraphQL call.



24
25
26
# File 'lib/sls_adf/query.rb', line 24

def user(id)
  execute_query(SlsAdf::Template::Query::User, id: id, first: 10)
end