Class: Verso::Occupation

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

Overview

Occupation resource

An occupation is contained by a Pathway

Note:

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

Options Hash (attrs):

  • :id (Fixnum)

    Occupation ID Required

See Also:

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

#descriptionString (readonly)

Returns HTML-formatted Occupation description.

Returns:

  • (String)

    HTML-formatted Occupation description



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/verso/occupation.rb', line 22

class Occupation < Verso::Base
  include HTTPGettable
  attr_reader :description, :id, :preparations, :title

  # @return [Verso::Pathway] Pathway that is the parent of this occupation
  def pathway
    @pathway ||= Pathway.new(get_attr(:pathway))
  end

  # @return [Array] Collection of related {Verso::Course} objects
  def related_courses
    @related_courses ||= get_attr(:related_courses).
                           collect { |c| Course.new(c) }
  end

private

  def fetch
    super[:occupation]
  end

  def path
    "/occupations/#{id}"
  end
end

#idFixnum (readonly)

Returns Occupation ID.

Returns:

  • (Fixnum)

    Occupation ID



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/verso/occupation.rb', line 22

class Occupation < Verso::Base
  include HTTPGettable
  attr_reader :description, :id, :preparations, :title

  # @return [Verso::Pathway] Pathway that is the parent of this occupation
  def pathway
    @pathway ||= Pathway.new(get_attr(:pathway))
  end

  # @return [Array] Collection of related {Verso::Course} objects
  def related_courses
    @related_courses ||= get_attr(:related_courses).
                           collect { |c| Course.new(c) }
  end

private

  def fetch
    super[:occupation]
  end

  def path
    "/occupations/#{id}"
  end
end

#preparationsArray (readonly)

Returns Collection of preparation titles (strings).

Returns:

  • (Array)

    Collection of preparation titles (strings)



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/verso/occupation.rb', line 22

class Occupation < Verso::Base
  include HTTPGettable
  attr_reader :description, :id, :preparations, :title

  # @return [Verso::Pathway] Pathway that is the parent of this occupation
  def pathway
    @pathway ||= Pathway.new(get_attr(:pathway))
  end

  # @return [Array] Collection of related {Verso::Course} objects
  def related_courses
    @related_courses ||= get_attr(:related_courses).
                           collect { |c| Course.new(c) }
  end

private

  def fetch
    super[:occupation]
  end

  def path
    "/occupations/#{id}"
  end
end

#titleString (readonly)

Returns Occupation title.

Returns:

  • (String)

    Occupation title



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/verso/occupation.rb', line 22

class Occupation < Verso::Base
  include HTTPGettable
  attr_reader :description, :id, :preparations, :title

  # @return [Verso::Pathway] Pathway that is the parent of this occupation
  def pathway
    @pathway ||= Pathway.new(get_attr(:pathway))
  end

  # @return [Array] Collection of related {Verso::Course} objects
  def related_courses
    @related_courses ||= get_attr(:related_courses).
                           collect { |c| Course.new(c) }
  end

private

  def fetch
    super[:occupation]
  end

  def path
    "/occupations/#{id}"
  end
end

Instance Method Details

#pathwayVerso::Pathway

Returns Pathway that is the parent of this occupation.

Returns:



27
28
29
# File 'lib/verso/occupation.rb', line 27

def pathway
  @pathway ||= Pathway.new(get_attr(:pathway))
end

Returns Collection of related Course objects.

Returns:

  • (Array)

    Collection of related Course objects



32
33
34
35
# File 'lib/verso/occupation.rb', line 32

def related_courses
  @related_courses ||= get_attr(:related_courses).
                         collect { |c| Course.new(c) }
end