class TinCanApi::StatementRef
StatementRef
Class used when referencing another statement from a statement's object property
Attributes
id[RW]
object_type[RW]
Public Class Methods
new(options={}, &block)
click to toggle source
# File lib/tin_can_api/statement_ref.rb, line 8 def initialize(options={}, &block) @object_type = 'StatementRef' json = options.fetch(:json, nil) if json attributes = JSON.parse(json) self.id = attributes['id'] if attributes['id'] else self.id = options.fetch(:id, nil) if block_given? block[self] end end end
Public Instance Methods
serialize(version)
click to toggle source
# File lib/tin_can_api/statement_ref.rb, line 23 def serialize(version) node = {} node['id'] = id if id node['objectType'] = object_type node end