Class: Verso::Standard
- Includes:
- HTTPGettable
- Defined in:
- lib/verso/standard.rb
Overview
Standard resource
A standard that has been associated with a Course.
Instance Attribute Summary collapse
-
#code ⇒ String
readonly
Course code.
-
#edition ⇒ String
readonly
Course edition year.
-
#name ⇒ String
readonly
Standard name used as an identifier.
-
#title ⇒ String
readonly
Standard title.
Attributes inherited from Base
Instance Method Summary collapse
-
#description ⇒ String
Description.
-
#goals ⇒ Array
Collection of goals with #title, #description strings.
-
#sections ⇒ Array
Collection of contained Standard objects.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Verso::Base
Instance Attribute Details
#code ⇒ String (readonly)
Returns Course code.
23 24 25 26 27 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 |
# File 'lib/verso/standard.rb', line 23 class Standard < Verso::Base include HTTPGettable attr_reader :code, :edition, :name, :title # @return [String] description def description get_attr(:description).to_s # sometimes nil end # @return [Array] collection of goals with #title, #description strings def goals @goals ||= get_attr(:goals). collect { |raw_standard| OpenStruct.new(raw_standard) } end # @return [Array] collection of contained {Verso::Standard} objects def sections @sections ||= get_attr(:sections). collect do |raw_section| Standard.new( raw_section.merge(:code => code, :edition => edition, :name => name) ) end end private def fetch super[:standard] end def path "/courses/#{code},#{edition}/standards/#{name}" end end |
#edition ⇒ String (readonly)
Returns Course edition year.
23 24 25 26 27 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 |
# File 'lib/verso/standard.rb', line 23 class Standard < Verso::Base include HTTPGettable attr_reader :code, :edition, :name, :title # @return [String] description def description get_attr(:description).to_s # sometimes nil end # @return [Array] collection of goals with #title, #description strings def goals @goals ||= get_attr(:goals). collect { |raw_standard| OpenStruct.new(raw_standard) } end # @return [Array] collection of contained {Verso::Standard} objects def sections @sections ||= get_attr(:sections). collect do |raw_section| Standard.new( raw_section.merge(:code => code, :edition => edition, :name => name) ) end end private def fetch super[:standard] end def path "/courses/#{code},#{edition}/standards/#{name}" end end |
#name ⇒ String (readonly)
Returns Standard name used as an identifier.
23 24 25 26 27 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 |
# File 'lib/verso/standard.rb', line 23 class Standard < Verso::Base include HTTPGettable attr_reader :code, :edition, :name, :title # @return [String] description def description get_attr(:description).to_s # sometimes nil end # @return [Array] collection of goals with #title, #description strings def goals @goals ||= get_attr(:goals). collect { |raw_standard| OpenStruct.new(raw_standard) } end # @return [Array] collection of contained {Verso::Standard} objects def sections @sections ||= get_attr(:sections). collect do |raw_section| Standard.new( raw_section.merge(:code => code, :edition => edition, :name => name) ) end end private def fetch super[:standard] end def path "/courses/#{code},#{edition}/standards/#{name}" end end |
#title ⇒ String (readonly)
Returns Standard title.
23 24 25 26 27 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 |
# File 'lib/verso/standard.rb', line 23 class Standard < Verso::Base include HTTPGettable attr_reader :code, :edition, :name, :title # @return [String] description def description get_attr(:description).to_s # sometimes nil end # @return [Array] collection of goals with #title, #description strings def goals @goals ||= get_attr(:goals). collect { |raw_standard| OpenStruct.new(raw_standard) } end # @return [Array] collection of contained {Verso::Standard} objects def sections @sections ||= get_attr(:sections). collect do |raw_section| Standard.new( raw_section.merge(:code => code, :edition => edition, :name => name) ) end end private def fetch super[:standard] end def path "/courses/#{code},#{edition}/standards/#{name}" end end |
Instance Method Details
#description ⇒ String
Returns description.
28 29 30 |
# File 'lib/verso/standard.rb', line 28 def description get_attr(:description).to_s # sometimes nil end |
#goals ⇒ Array
Returns collection of goals with #title, #description strings.
33 34 35 36 |
# File 'lib/verso/standard.rb', line 33 def goals @goals ||= get_attr(:goals). collect { |raw_standard| OpenStruct.new(raw_standard) } end |
#sections ⇒ Array
Returns collection of contained Verso::Standard objects.
40 41 42 43 44 45 46 47 |
# File 'lib/verso/standard.rb', line 40 def sections @sections ||= get_attr(:sections). collect do |raw_section| Standard.new( raw_section.merge(:code => code, :edition => edition, :name => name) ) end end |