lusi_api 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +58 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +235 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/lusi_api.rb +5 -0
- data/lib/lusi_api/calendar.rb +234 -0
- data/lib/lusi_api/core/api.rb +190 -0
- data/lib/lusi_api/core/code.rb +101 -0
- data/lib/lusi_api/core/exceptions.rb +47 -0
- data/lib/lusi_api/core/lookup.rb +612 -0
- data/lib/lusi_api/core/util.rb +102 -0
- data/lib/lusi_api/core/xml.rb +168 -0
- data/lib/lusi_api/country.rb +111 -0
- data/lib/lusi_api/course.rb +1300 -0
- data/lib/lusi_api/enrolment.rb +247 -0
- data/lib/lusi_api/organisation.rb +291 -0
- data/lib/lusi_api/person/staff.rb +115 -0
- data/lib/lusi_api/person/student.rb +551 -0
- data/lib/lusi_api/service_account.rb +121 -0
- data/lib/lusi_api/service_method.rb +52 -0
- data/lib/lusi_api/version.rb +5 -0
- data/lib/lusi_api/vle.rb +329 -0
- data/lusi_api.gemspec +36 -0
- metadata +182 -0
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'lusi_api/core/xml'
|
2
|
+
require 'lusi_api/organisation'
|
3
|
+
require 'lusi_api/service_method'
|
4
|
+
|
5
|
+
|
6
|
+
module LUSI
|
7
|
+
module API
|
8
|
+
|
9
|
+
|
10
|
+
# Represents a service account used to access the LUSI API
|
11
|
+
class ServiceAccount
|
12
|
+
|
13
|
+
# @!attribute [rw] contact_email
|
14
|
+
# @return [String, nil] the email address of the service account owner
|
15
|
+
attr_accessor :contact_email
|
16
|
+
|
17
|
+
# @!attribute [rw] contact_name
|
18
|
+
# @return [String, nil] the full name of the service account owner
|
19
|
+
attr_accessor :contact_name
|
20
|
+
|
21
|
+
# @!attribute [rw] description
|
22
|
+
# @return [String, nil] the description of the service account
|
23
|
+
attr_accessor :description
|
24
|
+
|
25
|
+
# @!attribute [rw] expiry_date
|
26
|
+
# @return [DateTime, nil] the expiry date of the service account password
|
27
|
+
attr_accessor :expiry_date
|
28
|
+
|
29
|
+
# @!attribute [rw] institutions
|
30
|
+
# @return [Array<LUSI::API::Organisation::Unit>, nil] an array of institutions associated with this account
|
31
|
+
attr_accessor :institutions
|
32
|
+
|
33
|
+
# @!attribute [rw] service_methods
|
34
|
+
# @return [Array<LUSI::API::ServiceMethod>, nil] an array of ServiceMethod instances callable from this account
|
35
|
+
attr_accessor :service_methods
|
36
|
+
|
37
|
+
# @!attribute [rw] username
|
38
|
+
# @return [String, nil] the service account username
|
39
|
+
attr_accessor :username
|
40
|
+
|
41
|
+
# The characters used to generate a random service account password
|
42
|
+
PASSWORD_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!-_=+,.'
|
43
|
+
|
44
|
+
# Return a ServiceAccount instance for the API's service user
|
45
|
+
# @param api [LUSI::API::Core::API] the LUSI API instance
|
46
|
+
# @param lookup [LUSI::API::Core::Lookup::LookupService, nil] the lookup service for object resolution
|
47
|
+
# @return [Array<LUSI::API::ServiceAccount>] a list containing the ServiceAccount for the API's service user
|
48
|
+
# @yield [obj] Passes the ServiceAccount instance to the block
|
49
|
+
# @yieldparam obj [LUSI::API::ServiceAccount] the ServiceAccount instance
|
50
|
+
# @raise [LUSI::API::Core::APIError] if the API call fails
|
51
|
+
def self.get_instance(api, lookup = nil)
|
52
|
+
xml = api.call('LUSIReference', 'General.asmx', 'GetServiceAccountDetails')
|
53
|
+
LUSI::API::Core::XML::xml(xml, 'xmlns:ServiceAccount') do |s|
|
54
|
+
obj = LUSI::API::ServiceAccount.new(s, lookup)
|
55
|
+
yield(obj) if block_given?
|
56
|
+
obj
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# Creates a new ServiceAccount instance
|
61
|
+
# Fields are extracted from the parsed XML response to the LUSI GetServiceAccountDetails API call.
|
62
|
+
# Default values for fields missing from the XML can be specified as keyword arguments.
|
63
|
+
# @param xml [Nokogiri::XML::Node, nil] the XML response from the LUSI GetServiceAccountDetails API call, or nil
|
64
|
+
# @param lookup [LUSI::API::Core::Lookup::LookupService, nil] the lookup service for object resolution
|
65
|
+
# @param username [String, nil] the default username
|
66
|
+
# @param description [String, nil] the default description
|
67
|
+
# @param contact_name [String, nil] the default contact name
|
68
|
+
# @param contact_email [Stirng, nil] the default contact email
|
69
|
+
# @param expiry_date [DateTime, nil] the default expiry date
|
70
|
+
# @param institutions [Array<LUSI::API::Institution>] the default institution list
|
71
|
+
# @param service_methods [Array<LUSI::API::ServiceMethod>] the default service method list
|
72
|
+
# @return [void]
|
73
|
+
def initialize(xml = nil, lookup = nil, username: nil, description: nil, contact_name: nil, contact_email: nil,
|
74
|
+
expiry_date: DateTime, institutions: nil, service_methods: nil)
|
75
|
+
@contact_email = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:ContactEmail', contact_email)
|
76
|
+
@contact_name = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:ContactName', contact_name)
|
77
|
+
@description = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Description', description)
|
78
|
+
@expiry_date = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:ExpiryDate', expiry_date)
|
79
|
+
@institutions = LUSI::API::Core::XML.xml(xml, 'xmlns:Institutions', institutions).map { |i| LUSI::API::Core::XML.lookup(i, lookup, :institution, 'xmlns:Institution') }
|
80
|
+
@service_methods = LUSI::API::Core::XML.xml(xml, 'xmlns:ServiceMethods/xmlns:ServiceMethod', service_methods).map { |m| LUSI::API::ServiceMethod.new(m, lookup) }
|
81
|
+
@username = LUSI::API::Core::XML.xml_content_at('xmlns:Username')
|
82
|
+
end
|
83
|
+
|
84
|
+
# Returns a String representation of the ServiceAccount instance (the service username)
|
85
|
+
# @return [String] the string representation of the ServiceAccount instance
|
86
|
+
def to_s
|
87
|
+
@username
|
88
|
+
end
|
89
|
+
|
90
|
+
# Generates a 16-character random password for the service account
|
91
|
+
# @return [String] the generated password
|
92
|
+
def self.generate_service_account_password
|
93
|
+
password = []
|
94
|
+
random = Random::new
|
95
|
+
(0..16).each { |i| password.push(PASSWORD_CHARS[random.rand(PASSWORD_CHARS.length)]) }
|
96
|
+
password.join('')
|
97
|
+
end
|
98
|
+
|
99
|
+
# Sets a new password on the service account
|
100
|
+
# @param api [LUSI::API::Core::API] the LUSI API configured with the service account to be updated
|
101
|
+
# @param password [String, nil] the new password (if nil, a 16-digit random password will be generated)
|
102
|
+
# @return [String] the new password
|
103
|
+
# @raise [LUSI::API::Core::APIError] if the LUSI API call fails
|
104
|
+
def self.update_service_account_password(api, password = nil)
|
105
|
+
|
106
|
+
# Generate a password if required
|
107
|
+
password ||= generate_service_account_password
|
108
|
+
|
109
|
+
# Update the password
|
110
|
+
xml = api.call('LUSIReference', 'General.asmx', 'UpdateServiceAccountPassword', NewPassword: password)
|
111
|
+
|
112
|
+
# Return the new password
|
113
|
+
password
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'lusi_api/core/xml'
|
2
|
+
|
3
|
+
module LUSI
|
4
|
+
module API
|
5
|
+
|
6
|
+
|
7
|
+
# Represents a LUSI API service method
|
8
|
+
class ServiceMethod
|
9
|
+
|
10
|
+
# @!attribute [rw] endpoint
|
11
|
+
# @return [String] the endpoint component of the web service address (e.g. 'General.asmx')
|
12
|
+
attr_accessor :endpoint
|
13
|
+
|
14
|
+
# @!attribute [rw] method_name
|
15
|
+
# @return [String] the method name of the web service (e.g. 'GetServiceAccountDetails')
|
16
|
+
attr_accessor :method_name
|
17
|
+
|
18
|
+
# @!attribute [rw] url
|
19
|
+
# @return [String] the web service URL root, excluding the endpoint and method name
|
20
|
+
attr_accessor :url
|
21
|
+
|
22
|
+
# @!attribute [rw] web_service
|
23
|
+
# @return [String] the web service name
|
24
|
+
attr_accessor :web_service
|
25
|
+
|
26
|
+
# Initialize a new ServiceMethod instance
|
27
|
+
# Fields are extracted from the parsed XML from the LUSI API response. A single <ServiceMethod> element is expected.
|
28
|
+
# Default values for fields missing from the XML can be specified as keyword arguments.
|
29
|
+
# @param xml [Nokogiri::XML::Node, Nokogiri:nil] the XML response from the LUSI GetServiceAccountDetails API call, or nil
|
30
|
+
# @param lookup [LUSI::API::Core::Lookup::LookupService, nil] the lookup service for object resolution
|
31
|
+
# @param web_service [String, nil] the default web service name
|
32
|
+
# @param url [Stirng, nil] the default URL
|
33
|
+
# @param endpoint [String, nil] the default endpoint name
|
34
|
+
# @param method_name [String, nil] the default method name
|
35
|
+
def initialize(xml = nil, lookup = nil, web_service: nil, url: nil, endpoint: nil, method_name: nil)
|
36
|
+
@web_service = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:WebService', web_service)
|
37
|
+
@url = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Url', url)
|
38
|
+
@endpoint = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:EndPoint', endpoint)
|
39
|
+
@method_name = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:MethodName', method_name)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Return a string representation of the ServiceMethod instance (the full URL path)
|
43
|
+
# @return [String] the string representation of the ServiceMethod instance
|
44
|
+
def to_s
|
45
|
+
"#{@url}/#{@endpoint}/#{@method_name}"
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
data/lib/lusi_api/vle.rb
ADDED
@@ -0,0 +1,329 @@
|
|
1
|
+
require 'lusi_api/core/code'
|
2
|
+
require 'lusi_api/core/xml'
|
3
|
+
require 'lusi_api/course'
|
4
|
+
require 'lusi_api/enrolment'
|
5
|
+
|
6
|
+
module LUSI
|
7
|
+
module API
|
8
|
+
module VLE
|
9
|
+
class Department
|
10
|
+
# @!attribute [rw] identity
|
11
|
+
# @return [String] the department identity
|
12
|
+
attr_accessor :identity
|
13
|
+
|
14
|
+
# @!attribute [rw] org_unit
|
15
|
+
# @return [LUSI::API::Organisation::Unit] the organisation unit
|
16
|
+
# representing the department
|
17
|
+
attr_accessor :org_unit
|
18
|
+
|
19
|
+
# @!attribute [rw] title
|
20
|
+
# @return [String] the department name
|
21
|
+
attr_accessor :title
|
22
|
+
|
23
|
+
# Initialises a new Department instance
|
24
|
+
# @param identity [String] the department's identity
|
25
|
+
# @param org_unit [LUSI::API::Organisation::Unit] the organisation unit
|
26
|
+
# for the department
|
27
|
+
# @param title [String] the department's title
|
28
|
+
# @return [void]
|
29
|
+
def initialize(xml = nil, lookup = nil, identity: nil, org_unit: nil,
|
30
|
+
title: nil)
|
31
|
+
@identity = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Identity', identity)
|
32
|
+
@org_unit = LUSI::API::Core::XML.lookup(xml, lookup, :department, 'xmlns:Identity', org_unit)
|
33
|
+
@title = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Title', title)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Returns a string representation of the Department instance
|
37
|
+
# @return [String] the string representation of the Department instance
|
38
|
+
def to_s
|
39
|
+
title
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class VLESpaceCourse
|
44
|
+
# @!attribute [rw] identity
|
45
|
+
# @return [LUSI::API::Course::EnrolmentIdentity] the VLE space course
|
46
|
+
# identity
|
47
|
+
attr_accessor :identity
|
48
|
+
|
49
|
+
# @!attribute [rw] display_long_title
|
50
|
+
# @return [String, nil] the long course title
|
51
|
+
attr_accessor :display_long_title
|
52
|
+
|
53
|
+
# @!attribute [rw] display_short_title
|
54
|
+
# @return [String, nil] the short course title
|
55
|
+
attr_accessor :display_short_title
|
56
|
+
|
57
|
+
# @!attribute [rw] department
|
58
|
+
# @return [LUSI::API::VLE::Department] the department
|
59
|
+
attr_accessor :department
|
60
|
+
|
61
|
+
# @!attribute [rw] talis_code
|
62
|
+
# @return [String, nil] the Talis Aspire course code
|
63
|
+
attr_accessor :talis_code
|
64
|
+
|
65
|
+
# Initialises a new VLESpaceCourse instance
|
66
|
+
# @return [void]
|
67
|
+
def initialize(xml = nil, lookup = nil,
|
68
|
+
department: nil, display_long_title: nil,
|
69
|
+
display_short_title: nil, identity: nil, talis_code: nil)
|
70
|
+
@department = LUSI::API::VLE::Department.new(LUSI::API::Core::XML.xml_at(xml, 'xmlns:Department', department), lookup)
|
71
|
+
@display_long_title = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:DisplayLongTitle', display_long_title)
|
72
|
+
@display_short_title = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:DisplayShortTitle', display_short_title)
|
73
|
+
@identity = LUSI::API::Course::EnrolmentIdentity.new(LUSI::API::Core::XML.xml_at(xml, 'xmlns:Identity', identity), lookup)
|
74
|
+
@talis_code = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:TalisCode', talis_code)
|
75
|
+
end
|
76
|
+
|
77
|
+
# Returns a string representation of the VLESpaceCourse instance
|
78
|
+
# @return [String] the string representation of the VLESpaceCourse instance
|
79
|
+
def to_s
|
80
|
+
display_long_title || display_short_title
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class VLESpace
|
85
|
+
# @!attribute [rw] copy_course_materials_from_prev_session
|
86
|
+
# @return [Boolean, nil] the space copy flag
|
87
|
+
attr_accessor :copy_course_materials_from_prev_session
|
88
|
+
|
89
|
+
# @!attribute [rw] course_departments
|
90
|
+
# @return [Array<LUSI::API::Course::CourseDepartment>, nil] the list
|
91
|
+
# of associated course departments
|
92
|
+
attr_accessor :course_departments
|
93
|
+
|
94
|
+
# @!attribute [rw] course_type
|
95
|
+
# @return [String, nil] the course type (CMOD|SOS)
|
96
|
+
attr_accessor :course_type
|
97
|
+
|
98
|
+
# @!attribute [rw] create_space_date
|
99
|
+
# @return [DateTime, nil] the VLE space creation date
|
100
|
+
attr_accessor :create_space_date
|
101
|
+
|
102
|
+
# @!attribute [rw] create_space_date_utc
|
103
|
+
# @return [DateTime, nil] the UTC VLE space creation date
|
104
|
+
attr_accessor :create_space_date_utc
|
105
|
+
|
106
|
+
# @!attribute [rw] display_long_title
|
107
|
+
# @return [String, nil] the long course title
|
108
|
+
attr_accessor :display_long_title
|
109
|
+
|
110
|
+
# @!attribute [rw] display_short_title
|
111
|
+
# @return [String, nil] the short course title
|
112
|
+
attr_accessor :display_short_title
|
113
|
+
|
114
|
+
# @!attribute [rw] end_date
|
115
|
+
# @return [DateTime, nil] the VLE space end date
|
116
|
+
attr_accessor :end_date
|
117
|
+
|
118
|
+
# @!attribute [rw] end_date_utc
|
119
|
+
# @return [DateTime, nil] the UTC VLE space end date
|
120
|
+
attr_accessor :end_date_utc
|
121
|
+
|
122
|
+
# @!attribute [rw] hide_content_on_rollover
|
123
|
+
# @return [Boolean, nil] the hide content on rollover flag
|
124
|
+
attr_accessor :hide_content_on_rollover
|
125
|
+
|
126
|
+
# @!attribute [rw] is_conversion_space
|
127
|
+
# @return [Boolean, nil] the space conversion flag
|
128
|
+
attr_accessor :is_conversion_space
|
129
|
+
|
130
|
+
# @!attribute [rw] lusi_year_id
|
131
|
+
# @return [String] the year identity code
|
132
|
+
attr_accessor :lusi_year_id
|
133
|
+
|
134
|
+
# @!attribute [rw] lusi_vle_space_id
|
135
|
+
# @return [String] the VLE space ID
|
136
|
+
attr_accessor :lusi_vle_space_id
|
137
|
+
|
138
|
+
# @!attribute [rw] space_type
|
139
|
+
# @return [String, nil] the space type (SINGLE|SHARED)
|
140
|
+
attr_accessor :space_type
|
141
|
+
|
142
|
+
# @!attribute [rw] start_date
|
143
|
+
# @return [DateTime, nil] the VLE space start date
|
144
|
+
attr_accessor :start_date
|
145
|
+
|
146
|
+
# @!attribute [rw] start_date_utc
|
147
|
+
# @return [DateTime, nil] the UTC VLE space start date
|
148
|
+
attr_accessor :start_date_utc
|
149
|
+
|
150
|
+
# @!attribute [rw] student_access_date
|
151
|
+
# @return [DateTime, nil] the VLE space student access date
|
152
|
+
attr_accessor :student_access_date
|
153
|
+
|
154
|
+
# @!attribute [rw] student_access_date_utc
|
155
|
+
# @return [DateTime, nil] the UTC VLE space student access date
|
156
|
+
attr_accessor :student_access_date_utc
|
157
|
+
|
158
|
+
# @!attribute [rw] url
|
159
|
+
# @return [String, nil] the VLE space URL
|
160
|
+
attr_accessor :url
|
161
|
+
|
162
|
+
# @!attribute [rw] vle_provider
|
163
|
+
# @return [LUSI::API::Core::Code, nil] the VLE provider
|
164
|
+
attr_accessor :vle_provider
|
165
|
+
|
166
|
+
# @!attribute [rw] vle_space_courses
|
167
|
+
# @return [Array<LUSI::API::VLESpace::VLESpaceCourse>, nil] the list
|
168
|
+
# of associated courses
|
169
|
+
attr_accessor :vle_space_courses
|
170
|
+
|
171
|
+
# @!attribute [rw] vle_template
|
172
|
+
# @return [LUSI::API::Core::Code, nil] the VLE template
|
173
|
+
attr_accessor :vle_template
|
174
|
+
|
175
|
+
# Returns an array of instances matching the specified search criteria
|
176
|
+
# @param api [LUSI::API::Core::API] the LUSI API instance for searching
|
177
|
+
# @param (see #get_instance_params)
|
178
|
+
# @return [<Array<LUSI::API::VLE::VLESpace>] the matching instances
|
179
|
+
# @yield [obj] Passes the instance to the block
|
180
|
+
# @yieldparam obj [LUSI::API::VLE::VLESpace] the instance
|
181
|
+
def self.get_instance(api, lookup = nil, **kwargs)
|
182
|
+
params = get_instance_params(**kwargs)
|
183
|
+
xml = api.call('LUSIReference', 'General.asmx', 'GetVLESpaces',
|
184
|
+
**params)
|
185
|
+
LUSI::API::Core::XML.xml(xml, 'xmlns:VLESpace') do |m|
|
186
|
+
obj = self.new(m, lookup)
|
187
|
+
yield(obj) if block_given?
|
188
|
+
obj
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
# Returns a hash of parameters for the LUSI API call.
|
193
|
+
# @param asp_identity [String, nil] return instances matching this
|
194
|
+
# academic significant period (ASP)
|
195
|
+
# @param cohort_identity (String, nil) return instances matching this
|
196
|
+
# cohort identity
|
197
|
+
# @param course_identity [String, nil] return instances matching this
|
198
|
+
# course identity
|
199
|
+
# @param course_type [String, nil] return instances matching this course
|
200
|
+
# type (CMOD|SOS)
|
201
|
+
# @param department_identity (String, nil) return instances matching
|
202
|
+
# this department identity
|
203
|
+
# @param space_type [String, nil] return instances matching this space
|
204
|
+
# type (SHARED|SINGLE)
|
205
|
+
# @param vle_space_identity [String, nil] return instances matching this
|
206
|
+
# VLE space identity
|
207
|
+
# @param vle_provider_identity [String, nil] return instances matching
|
208
|
+
# this VLE provider identity
|
209
|
+
# @param year_identity (String, nil) return instances matching this year
|
210
|
+
# identity
|
211
|
+
# @param active_vle_space_only [Boolean, nil] if true, return only
|
212
|
+
# active VLE spaces, otherwise return all spaces
|
213
|
+
# @return [Array<VLESpace>, nil] the matching VLESpace instances
|
214
|
+
# @yield [obj] Passes the VLESpace instance to the block
|
215
|
+
# @yieldparam obj [LUSI::API::VLE::VLESpace] the VLESpace instance
|
216
|
+
def self.get_instance_params(**kwargs)
|
217
|
+
{
|
218
|
+
ActiveVLESpaceOnly: kwargs.fetch(:active_vle_space_only, true) ? 'true' : 'false',
|
219
|
+
ASPIdentity: kwargs.fetch(:asp_identity, ''),
|
220
|
+
CohortIdentity: kwargs.fetch(:cohort_identity, ''),
|
221
|
+
CourseIdentity: kwargs.fetch(:course_identity, ''),
|
222
|
+
CourseType: kwargs.fetch(:course_type, ''),
|
223
|
+
DepartmentIdentity: kwargs.fetch(:department_identity, ''),
|
224
|
+
SpaceType: kwargs.fetch(:space_type, ''),
|
225
|
+
VLEProviderIdentity: kwargs.fetch(:vle_provider_identity, ''),
|
226
|
+
VLESpaceIdentity: kwargs.fetch(:vle_space_identity, ''),
|
227
|
+
YearIdentity: kwargs.fetch(:year_identity, '')
|
228
|
+
}
|
229
|
+
end
|
230
|
+
|
231
|
+
# Initialises a new VLESpace instance
|
232
|
+
# @param xml [Nokogiri::XML::Document, Nokogiri::XML::Node] the parsed XML root of the VLE space
|
233
|
+
# @param lookup [LUSI::API::Core::Lookup::LookupService, nil] the lookup service for object resolution
|
234
|
+
# @param copy_course_materials_from_prev_session [Boolean, nil] the
|
235
|
+
# default space copy flag
|
236
|
+
# @param course_departments [Array<LUSI::API::Course::CourseDepartment>, nil] the default course departments
|
237
|
+
# @param course_type [String, nil] the default course type
|
238
|
+
# @param create_space_date [DateTime] the default VLE space creation date
|
239
|
+
# @param create_space_date_utc [DateTime] the default UTC VLE space creation date
|
240
|
+
# @param display_long_title [String, nil] the default long title
|
241
|
+
# @param display_short_title [String, nil] the default short title
|
242
|
+
# @param end_date [DateTime] the default VLE space end date
|
243
|
+
# @param end_date_utc [DateTime] the default UTC VLE space end date
|
244
|
+
# @param hide_content_on_rollover [Boolean, nil] the default hide
|
245
|
+
# content on rollover flag
|
246
|
+
# @param is_conversion_space [Boolean, nil] the default conversion space
|
247
|
+
# flag
|
248
|
+
# @param lusi_vle_space_id [String, nil] the default VLE space ID
|
249
|
+
# @param lusi_year_id [String, nil] the default year identity code
|
250
|
+
# @param space_type [String, nil] the default space type
|
251
|
+
# @param start_date [DateTime] the default VLE space start date
|
252
|
+
# @param start_date_utc [DateTime] the default UTC VLE space start date
|
253
|
+
# @param student_access_date [DateTime] the default student enrolment date
|
254
|
+
# @param student_access_date_utc [DateTime] the default UTC student enrolment date
|
255
|
+
# @param url [String, nil] the URL for the VLE space
|
256
|
+
# @param vle_provider [LUSI::API::Core::Code] the VLE provider
|
257
|
+
# @param vle_space_courses [Array<LUSI::API::VLESpace::VLESpaceCourse>]
|
258
|
+
# the list of associated courses
|
259
|
+
# @param vle_template [LUSI::API::Core::Code] the VLE template
|
260
|
+
# @return [void]
|
261
|
+
def initialize(xml = nil, lookup = nil,
|
262
|
+
copy_course_materials_from_prev_session: nil,
|
263
|
+
course_departments: nil,
|
264
|
+
course_type: nil,
|
265
|
+
create_space_date: nil,
|
266
|
+
create_space_date_utc: nil,
|
267
|
+
display_long_title: nil,
|
268
|
+
display_short_title: nil,
|
269
|
+
end_date: nil,
|
270
|
+
end_date_utc: nil,
|
271
|
+
hide_content_on_rollover: nil,
|
272
|
+
is_conversion_space: nil,
|
273
|
+
lusi_vle_space_id: nil,
|
274
|
+
lusi_year_id: nil,
|
275
|
+
space_type: nil,
|
276
|
+
start_date: nil,
|
277
|
+
start_date_utc: nil,
|
278
|
+
student_access_date: nil,
|
279
|
+
student_access_date_utc: nil,
|
280
|
+
url: nil,
|
281
|
+
vle_provider: nil,
|
282
|
+
vle_space_courses: nil,
|
283
|
+
vle_template: nil)
|
284
|
+
@copy_course_materials_from_prev_session = LUSI::API::Core::XML.xml_boolean_at(xml, 'xmlns:CopyCourseMaterialsFromPrevSession', copy_course_materials_from_prev_session)
|
285
|
+
@course_departments = LUSI::API::Core::XML.xml(xml, 'xmlns:Departments/xmlns:CourseDepartment',
|
286
|
+
course_departments) { |d| LUSI::API::Course::CourseDepartment.new(d, lookup) }
|
287
|
+
@course_type = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:CourseType', course_type)
|
288
|
+
@create_space_date = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:CreateSpaceDate', create_space_date)
|
289
|
+
@create_space_date_utc = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:CreateSpaceDateUTC', create_space_date_utc)
|
290
|
+
@display_long_title = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:DisplayLongTitle', display_long_title)
|
291
|
+
@display_short_title = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:DisplayShortTitle',
|
292
|
+
display_short_title)
|
293
|
+
@end_date = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:EndDate', end_date)
|
294
|
+
@end_date_utc = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:EndDateUTC', end_date_utc)
|
295
|
+
@hide_content_on_rollover = LUSI::API::Core::XML.xml_boolean_at(xml, 'xmlns:HideContentOnRollover', hide_content_on_rollover)
|
296
|
+
@is_conversion_space = LUSI::API::Core::XML.xml_boolean_at(xml, 'xmlns:IsConversionSpace', is_conversion_space)
|
297
|
+
@lusi_vle_space_id = LUSI::API::Core::XML.xml_content_at(xml, '@LUSIVLESpaceId', lusi_vle_space_id)
|
298
|
+
@lusi_year_id = LUSI::API::Core::XML.xml_content_at(xml, '@LUSIYearId', lusi_year_id)
|
299
|
+
@space_type = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:SpaceType', space_type)
|
300
|
+
@start_date = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:StartDate', start_date)
|
301
|
+
@start_date_utc = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:StartDateUTC', start_date_utc)
|
302
|
+
@student_access_date = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:StudentAccessDate', student_access_date)
|
303
|
+
@student_access_date_utc = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:StudentAccessDateUTC', student_access_date_utc)
|
304
|
+
@url = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:URL', url)
|
305
|
+
|
306
|
+
@vle_provider = LUSI::API::Core::Code.new(LUSI::API::Core::XML.xml_at(xml, 'xmlns:VLEProvider',
|
307
|
+
vle_provider), lookup)
|
308
|
+
@vle_space_courses = LUSI::API::Core::XML.xml(xml, 'xmlns:VLESpaceCourses/xmlns:VLESpaceCourse',
|
309
|
+
vle_space_courses) { |c| VLESpaceCourse.new(c, lookup) }
|
310
|
+
@vle_template = LUSI::API::Core::Code.new(LUSI::API::Core::XML.xml_at(xml, 'xmlns:VLETemplate',
|
311
|
+
vle_template), lookup)
|
312
|
+
end
|
313
|
+
|
314
|
+
# Returns a string representation of the VLESpace instance
|
315
|
+
# @return [String] the string representation of the VLESpace instance
|
316
|
+
def to_s
|
317
|
+
display_long_title || display_short_title
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
class ModuleVLEEnrolment < LUSI::API::Course::StaffModuleEnrolment
|
322
|
+
# @see (LUSI::API::Core::Endpoint#lusi_ws_method)
|
323
|
+
def self.lusi_ws_method
|
324
|
+
'BulkGetModuleVLEEnrolments'
|
325
|
+
end
|
326
|
+
end
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|