Class: ScormEngine::Models::Destination

Inherits:
Base
  • Object
show all
Defined in:
lib/scorm_engine/models/destination.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

#to_hash

Instance Attribute Details

#idString

The ID of this destination.

Returns:

  • (String)


7
8
9
# File 'lib/scorm_engine/models/destination.rb', line 7

def id
  @id
end

#nameString

The name of this destination.

Returns:

  • (String)


12
13
14
# File 'lib/scorm_engine/models/destination.rb', line 12

def name
  @name
end

Class Method Details

.new_from_api(options = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/scorm_engine/models/destination.rb', line 14

def self.new_from_api(options = {})
  this = new

  this.options = options.dup
  this.id = options["id"]

  # get_destinations (plural) returns values in a nested 'data' field.
  # get_destination (singular) does not.
  data = options["data"] || options
  this.name = data["name"]

  this
end