Class: Verso::Task

Inherits:
Base
  • Object
show all
Includes:
HTTPGettable
Defined in:
lib/verso/task.rb

Overview

Task resource

A Course task/competency contained by a DutyArea or a CorrelationList.

Note:

Any attributes may be set upon instantiation, using Options Hash. The following are required:

Options Hash (attrs):

  • :code (String)

    Course code Required

  • :edition (String)

    Edition year Required

  • :id (String)

    Task ID Required

Instance Attribute Summary collapse

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

attr_reader, #initialize

Constructor Details

This class inherits a constructor from Verso::Base

Instance Attribute Details

#codeString (readonly)



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verso/task.rb', line 28

class Task < Verso::Base
  include HTTPGettable
  attr_reader :code, :definition, :edition, :id, :sensitive, :statement,
    :questions
  alias sensitive? sensitive

  # @return [Boolean] Does this task have only a statement?
  def bare?
    definition.empty? && standards.sols.empty?
  end

  # @return [Boolean] Is this task considered essential?
  def essential
    sensitive ? true : get_attr(:essential)
  end
  alias essential? essential

  # @return [Verso::StandardsList] Standards related to this task
  def standards
    # Yuck. Inject goals if we already have them, i.e. a correlation list.
    # Otherwise, children will fetch resources and we get *all* the
    # standards in the correlation lists.
    raw_goals =  get_attr(:goals).collect do |k,v|
                   v.merge(:name => k, :code => code, :edition => edition)
                 end
    @standards ||= StandardsList.new(
      :code => code, :edition => edition, :standards => raw_goals
    )
  end
  alias goals standards

private

  def path
    "/courses/#{code},#{edition}/tasks/#{id}"
  end
end

#definitionString (readonly)



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verso/task.rb', line 28

class Task < Verso::Base
  include HTTPGettable
  attr_reader :code, :definition, :edition, :id, :sensitive, :statement,
    :questions
  alias sensitive? sensitive

  # @return [Boolean] Does this task have only a statement?
  def bare?
    definition.empty? && standards.sols.empty?
  end

  # @return [Boolean] Is this task considered essential?
  def essential
    sensitive ? true : get_attr(:essential)
  end
  alias essential? essential

  # @return [Verso::StandardsList] Standards related to this task
  def standards
    # Yuck. Inject goals if we already have them, i.e. a correlation list.
    # Otherwise, children will fetch resources and we get *all* the
    # standards in the correlation lists.
    raw_goals =  get_attr(:goals).collect do |k,v|
                   v.merge(:name => k, :code => code, :edition => edition)
                 end
    @standards ||= StandardsList.new(
      :code => code, :edition => edition, :standards => raw_goals
    )
  end
  alias goals standards

private

  def path
    "/courses/#{code},#{edition}/tasks/#{id}"
  end
end

#editionString (readonly)



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verso/task.rb', line 28

class Task < Verso::Base
  include HTTPGettable
  attr_reader :code, :definition, :edition, :id, :sensitive, :statement,
    :questions
  alias sensitive? sensitive

  # @return [Boolean] Does this task have only a statement?
  def bare?
    definition.empty? && standards.sols.empty?
  end

  # @return [Boolean] Is this task considered essential?
  def essential
    sensitive ? true : get_attr(:essential)
  end
  alias essential? essential

  # @return [Verso::StandardsList] Standards related to this task
  def standards
    # Yuck. Inject goals if we already have them, i.e. a correlation list.
    # Otherwise, children will fetch resources and we get *all* the
    # standards in the correlation lists.
    raw_goals =  get_attr(:goals).collect do |k,v|
                   v.merge(:name => k, :code => code, :edition => edition)
                 end
    @standards ||= StandardsList.new(
      :code => code, :edition => edition, :standards => raw_goals
    )
  end
  alias goals standards

private

  def path
    "/courses/#{code},#{edition}/tasks/#{id}"
  end
end

#idString (readonly)



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verso/task.rb', line 28

class Task < Verso::Base
  include HTTPGettable
  attr_reader :code, :definition, :edition, :id, :sensitive, :statement,
    :questions
  alias sensitive? sensitive

  # @return [Boolean] Does this task have only a statement?
  def bare?
    definition.empty? && standards.sols.empty?
  end

  # @return [Boolean] Is this task considered essential?
  def essential
    sensitive ? true : get_attr(:essential)
  end
  alias essential? essential

  # @return [Verso::StandardsList] Standards related to this task
  def standards
    # Yuck. Inject goals if we already have them, i.e. a correlation list.
    # Otherwise, children will fetch resources and we get *all* the
    # standards in the correlation lists.
    raw_goals =  get_attr(:goals).collect do |k,v|
                   v.merge(:name => k, :code => code, :edition => edition)
                 end
    @standards ||= StandardsList.new(
      :code => code, :edition => edition, :standards => raw_goals
    )
  end
  alias goals standards

private

  def path
    "/courses/#{code},#{edition}/tasks/#{id}"
  end
end

#questionsString (readonly)



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verso/task.rb', line 28

class Task < Verso::Base
  include HTTPGettable
  attr_reader :code, :definition, :edition, :id, :sensitive, :statement,
    :questions
  alias sensitive? sensitive

  # @return [Boolean] Does this task have only a statement?
  def bare?
    definition.empty? && standards.sols.empty?
  end

  # @return [Boolean] Is this task considered essential?
  def essential
    sensitive ? true : get_attr(:essential)
  end
  alias essential? essential

  # @return [Verso::StandardsList] Standards related to this task
  def standards
    # Yuck. Inject goals if we already have them, i.e. a correlation list.
    # Otherwise, children will fetch resources and we get *all* the
    # standards in the correlation lists.
    raw_goals =  get_attr(:goals).collect do |k,v|
                   v.merge(:name => k, :code => code, :edition => edition)
                 end
    @standards ||= StandardsList.new(
      :code => code, :edition => edition, :standards => raw_goals
    )
  end
  alias goals standards

private

  def path
    "/courses/#{code},#{edition}/tasks/#{id}"
  end
end

#sensitiveBoolean (readonly) Also known as: sensitive?



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verso/task.rb', line 28

class Task < Verso::Base
  include HTTPGettable
  attr_reader :code, :definition, :edition, :id, :sensitive, :statement,
    :questions
  alias sensitive? sensitive

  # @return [Boolean] Does this task have only a statement?
  def bare?
    definition.empty? && standards.sols.empty?
  end

  # @return [Boolean] Is this task considered essential?
  def essential
    sensitive ? true : get_attr(:essential)
  end
  alias essential? essential

  # @return [Verso::StandardsList] Standards related to this task
  def standards
    # Yuck. Inject goals if we already have them, i.e. a correlation list.
    # Otherwise, children will fetch resources and we get *all* the
    # standards in the correlation lists.
    raw_goals =  get_attr(:goals).collect do |k,v|
                   v.merge(:name => k, :code => code, :edition => edition)
                 end
    @standards ||= StandardsList.new(
      :code => code, :edition => edition, :standards => raw_goals
    )
  end
  alias goals standards

private

  def path
    "/courses/#{code},#{edition}/tasks/#{id}"
  end
end

#statementString (readonly)



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verso/task.rb', line 28

class Task < Verso::Base
  include HTTPGettable
  attr_reader :code, :definition, :edition, :id, :sensitive, :statement,
    :questions
  alias sensitive? sensitive

  # @return [Boolean] Does this task have only a statement?
  def bare?
    definition.empty? && standards.sols.empty?
  end

  # @return [Boolean] Is this task considered essential?
  def essential
    sensitive ? true : get_attr(:essential)
  end
  alias essential? essential

  # @return [Verso::StandardsList] Standards related to this task
  def standards
    # Yuck. Inject goals if we already have them, i.e. a correlation list.
    # Otherwise, children will fetch resources and we get *all* the
    # standards in the correlation lists.
    raw_goals =  get_attr(:goals).collect do |k,v|
                   v.merge(:name => k, :code => code, :edition => edition)
                 end
    @standards ||= StandardsList.new(
      :code => code, :edition => edition, :standards => raw_goals
    )
  end
  alias goals standards

private

  def path
    "/courses/#{code},#{edition}/tasks/#{id}"
  end
end

Instance Method Details

#bare?Boolean



35
36
37
# File 'lib/verso/task.rb', line 35

def bare?
  definition.empty? && standards.sols.empty?
end

#essentialBoolean Also known as: essential?



40
41
42
# File 'lib/verso/task.rb', line 40

def essential
  sensitive ? true : get_attr(:essential)
end

#standardsVerso::StandardsList Also known as: goals



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/verso/task.rb', line 46

def standards
  # Yuck. Inject goals if we already have them, i.e. a correlation list.
  # Otherwise, children will fetch resources and we get *all* the
  # standards in the correlation lists.
  raw_goals =  get_attr(:goals).collect do |k,v|
                 v.merge(:name => k, :code => code, :edition => edition)
               end
  @standards ||= StandardsList.new(
    :code => code, :edition => edition, :standards => raw_goals
  )
end