Class: Verso::Pathway

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

Overview

Pathway Resource

Note:

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

Options Hash (attrs):

  • :id (Fixnum)

    Pathway id Required

See Also:

Instance Attribute Summary collapse

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods included from Sluggable

#slug

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 Pathway description.

Returns:

  • (String)

    HTML-formatted Pathway description



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/verso/pathway.rb', line 18

class Pathway < Verso::Base
  include HTTPGettable
  include Sluggable
  attr_reader :description, :id, :title

  # @return [Verso::Cluster] Parent Cluster
  def cluster
    @cluster ||= Cluster.new(get_attr(:cluster))
  end

  # @return [Array] Children {Verso::Occupation} objects
  def occupations
    @occupations ||= get_attr(:occupations).
      collect { |o| Occupation.new(o) }
  end

private

  def fetch
    super[:pathway]
  end

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

#idFixnum (readonly)

Returns Pathway id.

Returns:

  • (Fixnum)

    Pathway id



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/verso/pathway.rb', line 18

class Pathway < Verso::Base
  include HTTPGettable
  include Sluggable
  attr_reader :description, :id, :title

  # @return [Verso::Cluster] Parent Cluster
  def cluster
    @cluster ||= Cluster.new(get_attr(:cluster))
  end

  # @return [Array] Children {Verso::Occupation} objects
  def occupations
    @occupations ||= get_attr(:occupations).
      collect { |o| Occupation.new(o) }
  end

private

  def fetch
    super[:pathway]
  end

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

#titleString (readonly)

Returns Pathway title.

Returns:

  • (String)

    Pathway title



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/verso/pathway.rb', line 18

class Pathway < Verso::Base
  include HTTPGettable
  include Sluggable
  attr_reader :description, :id, :title

  # @return [Verso::Cluster] Parent Cluster
  def cluster
    @cluster ||= Cluster.new(get_attr(:cluster))
  end

  # @return [Array] Children {Verso::Occupation} objects
  def occupations
    @occupations ||= get_attr(:occupations).
      collect { |o| Occupation.new(o) }
  end

private

  def fetch
    super[:pathway]
  end

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

Instance Method Details

#clusterVerso::Cluster

Returns Parent Cluster.

Returns:



24
25
26
# File 'lib/verso/pathway.rb', line 24

def cluster
  @cluster ||= Cluster.new(get_attr(:cluster))
end

#occupationsArray

Returns Children Occupation objects.

Returns:



29
30
31
32
# File 'lib/verso/pathway.rb', line 29

def occupations
  @occupations ||= get_attr(:occupations).
    collect { |o| Occupation.new(o) }
end