Class: RusticiSoftwareCloudV2::RegistrationSchema

Inherits:
Object
  • Object
show all
Defined in:
lib/rustici_software_cloud_v2/models/registration_schema.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ RegistrationSchema

Initializes the object

Parameters:

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

    Model attributes in the form of hash



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 117

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'instance')
    self.instance = attributes[:'instance']
  end

  if attributes.has_key?(:'xapiRegistrationId')
    self.xapi_registration_id = attributes[:'xapiRegistrationId']
  end

  if attributes.has_key?(:'dispatchId')
    self.dispatch_id = attributes[:'dispatchId']
  end

  if attributes.has_key?(:'updated')
    self.updated = attributes[:'updated']
  end

  if attributes.has_key?(:'registrationCompletion')
    self.registration_completion = attributes[:'registrationCompletion']
  end

  if attributes.has_key?(:'registrationCompletionAmount')
    self.registration_completion_amount = attributes[:'registrationCompletionAmount']
  end

  if attributes.has_key?(:'registrationSuccess')
    self.registration_success = attributes[:'registrationSuccess']
  end

  if attributes.has_key?(:'score')
    self.score = attributes[:'score']
  end

  if attributes.has_key?(:'totalSecondsTracked')
    self.total_seconds_tracked = attributes[:'totalSecondsTracked']
  end

  if attributes.has_key?(:'firstAccessDate')
    self.first_access_date = attributes[:'firstAccessDate']
  end

  if attributes.has_key?(:'lastAccessDate')
    self.last_access_date = attributes[:'lastAccessDate']
  end

  if attributes.has_key?(:'completedDate')
    self.completed_date = attributes[:'completedDate']
  end

  if attributes.has_key?(:'createdDate')
    self.created_date = attributes[:'createdDate']
  end

  if attributes.has_key?(:'course')
    self.course = attributes[:'course']
  end

  if attributes.has_key?(:'learner')
    self.learner = attributes[:'learner']
  end

  if attributes.has_key?(:'tags')
    if (value = attributes[:'tags']).is_a?(Array)
      self.tags = value
    end
  end

  if attributes.has_key?(:'globalObjectives')
    if (value = attributes[:'globalObjectives']).is_a?(Array)
      self.global_objectives = value
    end
  end

  if attributes.has_key?(:'sharedData')
    if (value = attributes[:'sharedData']).is_a?(Array)
      self.shared_data = value
    end
  end

  if attributes.has_key?(:'suspendedActivityId')
    self.suspended_activity_id = attributes[:'suspendedActivityId']
  end

  if attributes.has_key?(:'activityDetails')
    self.activity_details = attributes[:'activityDetails']
  end
end

Instance Attribute Details

#activity_detailsObject

Returns the value of attribute activity_details.



59
60
61
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 59

def activity_details
  @activity_details
end

#completed_dateObject

Returns the value of attribute completed_date.



43
44
45
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 43

def completed_date
  @completed_date
end

#courseObject

Returns the value of attribute course.



47
48
49
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 47

def course
  @course
end

#created_dateObject

Returns the value of attribute created_date.



45
46
47
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 45

def created_date
  @created_date
end

#dispatch_idObject

Dispatch ID for this registration, if applicable



25
26
27
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 25

def dispatch_id
  @dispatch_id
end

#first_access_dateObject

Returns the value of attribute first_access_date.



39
40
41
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 39

def first_access_date
  @first_access_date
end

#global_objectivesObject

Returns the value of attribute global_objectives.



53
54
55
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 53

def global_objectives
  @global_objectives
end

#idObject

Returns the value of attribute id.



17
18
19
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 17

def id
  @id
end

#instanceObject

Returns the value of attribute instance.



19
20
21
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 19

def instance
  @instance
end

#last_access_dateObject

Returns the value of attribute last_access_date.



41
42
43
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 41

def last_access_date
  @last_access_date
end

#learnerObject

Returns the value of attribute learner.



49
50
51
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 49

def learner
  @learner
end

#registration_completionObject

Returns the value of attribute registration_completion.



29
30
31
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 29

def registration_completion
  @registration_completion
end

#registration_completion_amountObject

Returns the value of attribute registration_completion_amount.



31
32
33
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 31

def registration_completion_amount
  @registration_completion_amount
end

#registration_successObject

Returns the value of attribute registration_success.



33
34
35
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 33

def registration_success
  @registration_success
end

#scoreObject

Returns the value of attribute score.



35
36
37
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 35

def score
  @score
end

#shared_dataObject

Returns the value of attribute shared_data.



55
56
57
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 55

def shared_data
  @shared_data
end

#suspended_activity_idObject

Returns the value of attribute suspended_activity_id.



57
58
59
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 57

def suspended_activity_id
  @suspended_activity_id
end

#tagsObject

Returns the value of attribute tags.



51
52
53
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 51

def tags
  @tags
end

#total_seconds_trackedObject

Returns the value of attribute total_seconds_tracked.



37
38
39
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 37

def total_seconds_tracked
  @total_seconds_tracked
end

#updatedObject

Returns the value of attribute updated.



27
28
29
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 27

def updated
  @updated
end

#xapi_registration_idObject

xAPI registration id associated with this registration



22
23
24
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 22

def xapi_registration_id
  @xapi_registration_id
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 62

def self.attribute_map
  {
    :'id' => :'id',
    :'instance' => :'instance',
    :'xapi_registration_id' => :'xapiRegistrationId',
    :'dispatch_id' => :'dispatchId',
    :'updated' => :'updated',
    :'registration_completion' => :'registrationCompletion',
    :'registration_completion_amount' => :'registrationCompletionAmount',
    :'registration_success' => :'registrationSuccess',
    :'score' => :'score',
    :'total_seconds_tracked' => :'totalSecondsTracked',
    :'first_access_date' => :'firstAccessDate',
    :'last_access_date' => :'lastAccessDate',
    :'completed_date' => :'completedDate',
    :'created_date' => :'createdDate',
    :'course' => :'course',
    :'learner' => :'learner',
    :'tags' => :'tags',
    :'global_objectives' => :'globalObjectives',
    :'shared_data' => :'sharedData',
    :'suspended_activity_id' => :'suspendedActivityId',
    :'activity_details' => :'activityDetails'
  }
end

.swagger_typesObject

Attribute type mapping.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 89

def self.swagger_types
  {
    :'id' => :'String',
    :'instance' => :'Integer',
    :'xapi_registration_id' => :'String',
    :'dispatch_id' => :'String',
    :'updated' => :'DateTime',
    :'registration_completion' => :'RegistrationCompletion',
    :'registration_completion_amount' => :'Float',
    :'registration_success' => :'RegistrationSuccess',
    :'score' => :'ScoreSchema',
    :'total_seconds_tracked' => :'Float',
    :'first_access_date' => :'DateTime',
    :'last_access_date' => :'DateTime',
    :'completed_date' => :'DateTime',
    :'created_date' => :'DateTime',
    :'course' => :'CourseReferenceSchema',
    :'learner' => :'LearnerSchema',
    :'tags' => :'Array<String>',
    :'global_objectives' => :'Array<ObjectiveSchema>',
    :'shared_data' => :'Array<SharedDataEntrySchema>',
    :'suspended_activity_id' => :'String',
    :'activity_details' => :'ActivityResultSchema'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 230

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      instance == o.instance &&
      xapi_registration_id == o.xapi_registration_id &&
      dispatch_id == o.dispatch_id &&
      updated == o.updated &&
      registration_completion == o.registration_completion &&
      registration_completion_amount == o.registration_completion_amount &&
      registration_success == o.registration_success &&
      score == o.score &&
      total_seconds_tracked == o.total_seconds_tracked &&
      first_access_date == o.first_access_date &&
      last_access_date == o.last_access_date &&
      completed_date == o.completed_date &&
      created_date == o.created_date &&
      course == o.course &&
      learner == o.learner &&
      tags == o.tags &&
      global_objectives == o.global_objectives &&
      shared_data == o.shared_data &&
      suspended_activity_id == o.suspended_activity_id &&
      activity_details == o.activity_details
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 292

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = RusticiSoftwareCloudV2.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 358

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 271

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


258
259
260
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 258

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



264
265
266
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 264

def hash
  [id, instance, xapi_registration_id, dispatch_id, updated, registration_completion, registration_completion_amount, registration_success, score, total_seconds_tracked, first_access_date, last_access_date, completed_date, created_date, course, learner, tags, global_objectives, shared_data, suspended_activity_id, activity_details].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



216
217
218
219
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 216

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



338
339
340
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 338

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



344
345
346
347
348
349
350
351
352
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 344

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



332
333
334
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 332

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



223
224
225
# File 'lib/rustici_software_cloud_v2/models/registration_schema.rb', line 223

def valid?
  true
end