Module: ScormEngine::Api::Endpoints::About

Included in:
ScormEngine::Api::Endpoints
Defined in:
lib/scorm_engine/api/endpoints/about.rb

Instance Method Summary collapse

Instance Method Details

#get_aboutScormEngine::Response

Get back the version and platform of the running instance of Engine



12
13
14
15
16
17
18
# File 'lib/scorm_engine/api/endpoints/about.rb', line 12

def get_about
  response = get("about")

  result = OpenStruct.new(response.body)

  Response.new(raw_response: response, result: result)
end

#get_about_user_count(options = {}) ⇒ ScormEngine::Response

Gets the number of users across all tenants.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :before (DateTime)

    Only userCount updated before the specified time (inclusive) are included. If a time zone is not specified, the server’s time zone will be used.

  • :since (DateTime)

    Only userCount updated since the specified time (inclusive) are included. If a time zone is not specified, the server’s time zone will be used.

Returns:

See Also:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/scorm_engine/api/endpoints/about.rb', line 37

def get_about_user_count(options = {})
  response = get("about/userCount", options)

  result = OpenStruct.new
  result.total = response.body["combinedTenants"]["total"]
  result.dispatched = response.body["combinedTenants"]["dispatched"]
  result.non_dispatched = response.body["combinedTenants"]["nonDispatched"]
  result.by_tenant = {}

  response.body["byTenant"].each do |tenant|
    result.by_tenant[tenant["tenantName"]] = OpenStruct.new(
      total: tenant["total"],
      dispatched: tenant["dispatched"],
      non_dispatched: tenant["nonDispatched"]
    )
  end

  Response.new(raw_response: response, result: result)
end