Class: ScormEngine::Models::Destination

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#idObject

TODO: Not sure we want this to be settable. Will depend on how we go about creating/updating records. For now it makes it easier to create instances from API options hash.



10
11
12
# File 'lib/scorm_engine/models/destination.rb', line 10

def id
  @id
end

#nameObject

TODO: Not sure we want this to be settable. Will depend on how we go about creating/updating records. For now it makes it easier to create instances from API options hash.



10
11
12
# File 'lib/scorm_engine/models/destination.rb', line 10

def name
  @name
end

#options=(value) ⇒ Object

Sets the attribute options

Parameters:

  • value

    the value to set the attribute options to.



4
5
6
# File 'lib/scorm_engine/models/destination.rb', line 4

def options=(value)
  @options = value
end

Class Method Details

.new_from_api(options = {}) ⇒ Object



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

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