Class: DmtdVbmappData::GuideChapterSection

Inherits:
Object
  • Object
show all
Defined in:
lib/dmtd_vbmapp_data/guide_chapter_section.rb

Overview

Provides for the retrieving of VB-MAPP Guide chapter sections from the VB-MAPP Data Server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ GuideChapterSection

Note:

This method does not block, simply creates an accessor and returns

Creates an accessor for the VB-MAPP Guide Chapter Section on the VB-MAPP Data Server

Parameters:

  • opts (Hash)

    a customizable set of options

Options Hash (opts):

  • :client (Client)

    A client instance

  • :chapter_num (Integer)

    The number (index 0..n) of the chapter in the Guide’s index array

  • :section_num (Integer)

    The number (index 0..n) of the section in the chapter’s sections array

  • :section_index_json (Hash)

    The guide index json for the chapter section in the format described at 1/guide/index REST api - Section Fields



33
34
35
36
37
38
39
40
# File 'lib/dmtd_vbmapp_data/guide_chapter_section.rb', line 33

def initialize(opts)
  @client = opts.fetch(:client)
  @chapter_num = opts.fetch(:chapter_num).to_i
  @section_num = opts.fetch(:section_num).to_i

  index_json = opts.fetch(:section_index_json)
  @title = index_json[:title]
end

Instance Attribute Details

#chapter_numObject (readonly)

Returns the value of attribute chapter_num.



14
15
16
# File 'lib/dmtd_vbmapp_data/guide_chapter_section.rb', line 14

def chapter_num
  @chapter_num
end

#clientObject (readonly)

Returns the value of attribute client.



10
11
12
# File 'lib/dmtd_vbmapp_data/guide_chapter_section.rb', line 10

def client
  @client
end

#section_numObject (readonly)

Returns the value of attribute section_num.



18
19
20
# File 'lib/dmtd_vbmapp_data/guide_chapter_section.rb', line 18

def section_num
  @section_num
end

Instance Method Details

#contentString

Note:

This method does block as the content is retrieved

Returns The content of the Guide’s chapter section.

Returns:

  • (String)

    The content of the Guide’s chapter section



45
46
47
48
49
# File 'lib/dmtd_vbmapp_data/guide_chapter_section.rb', line 45

def content
  @content = retrieve_guide_section[:content] if @content.nil?

  @content
end

#titleObject



22
23
24
# File 'lib/dmtd_vbmapp_data/guide_chapter_section.rb', line 22

def title
  @title
end