dmtd_vbmapp_data 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f317c1bc0647ce42661d7f24a4cf70bae76ece45
4
- data.tar.gz: 68fe6682f3b17e7c62ffeb0cac8b95bdf8f7b27a
3
+ metadata.gz: 1cb2f3858110be2b70e2f4f2b3dd8d0f22ec5013
4
+ data.tar.gz: 734c6b3c3b60ec11155ad34c2f1b0dccf9fdfe04
5
5
  SHA512:
6
- metadata.gz: 2bd4dd2a1f58cba26c137c8ddeda04b53860c2a3ab48a37f0edf34c3e0706dceacc5bb4b6d97bd11d1f54ec780b45bc4fe6ba19725f9bd27fb6f59a0a5782fb5
7
- data.tar.gz: 79ed50f44dc9f6b95711c800eb2f5ab01485224ef09e99d783db0c0554aa2dd44ce95a0c37e301cfc9c1f876612ffad5a28b8cbd90582cb412d64e0104e311d0
6
+ metadata.gz: 598f608e5cdb417831f10e20d920ec455eebc94565b6821f1723661bd6bb8872072f87bfdd69ec825101f05c872e95552ffce2776c79549ab8a695233053aba4
7
+ data.tar.gz: 8d21b2b595ec690be51861543314d3d7697522d86bb393925867881a1b52f9f780d09054cd82303c7d9485e4e4661fac00a40df11f494e073da1f60a3905e0d0
data/.travis.yml CHANGED
@@ -8,6 +8,7 @@ env:
8
8
  - secure: gP248+snjbNPc0Uk6+rcTqRCVOrC7xsI9kFDQMnC+k04qkZ4B2ZJbz8ZFhws1XFAd0SNhEsmqnxVuTwAIUxdsJpe8eEqUFIYpNRWz6KNL58yADmQX84BjeNLBM4BxPIej4crr+1i++KxW9WVMV1SAA6/5NQ9wR0fCC39HyaVmgk=
9
9
  - secure: Tv043DGoNh8bconcyqXVeWPnR81TrbLC2xwiUbdE6Utm9I5s34aqCjeiv1oV8Dd/OfqceHW9exQD9qBgD9VHsV+2VQhuamjwI4Oy4/PwHyyaMuSVKgvQsHfJRdxMNQbHNxfdYBhf4W6yYbSWquP8JzO3fnLtXEVEGDrDBxI3CRg=
10
10
  - secure: GRXGSJG3ygT//t/ADWGLV8G9xYgAs2twmMV9vjP8qpCDn0ijlk3KpwrieqO+Ewz4ru1u1GS6ha5KFlTA5pWRdzc75u7N7xHFbMnLSMe74U54pU12xuAgwo5mGjGm9KcjCRlR5d2aKAcuI2geTz2dfWAZTrjak7mQcy1APUoBmxk=
11
+ - secure: f/OsMLRzmj5KMoV8lGcpcSuEeftnnRMXCBkSZ12QZLHcJF02tfJhdFJL+Xqd4eLQdZwZs4i38eAGQbAwePi3PUEwUPflzP0EvsmPFfDWMARihnTW294KkBn8+1+TeKVlV2sGlumU6OH8mA+qss6J+ByroA5dMaAQaXaskiyHulI=
11
12
 
12
13
  before_install:
13
14
  - gem install bundler --no-rdoc --no-ri --no-document --quiet
data/CHANGELOG.md CHANGED
@@ -31,4 +31,8 @@
31
31
 
32
32
  ## 1.1.2
33
33
 
34
- * Added VbmappAreaQuestion fields: definition, objective, question_title
34
+ * Added VbmappAreaQuestion fields: definition, objective, question_title
35
+
36
+ ## 1.2.0
37
+
38
+ * Completely refactored the API according to the updated VBM Content Server API update
@@ -126,9 +126,9 @@ module DmtdVbmappData
126
126
 
127
127
  # @note This method does *not* block
128
128
  #
129
- # @return [Vbmapp]
129
+ # @return [Protocol]
130
130
  def vbmapp
131
- Vbmapp.new(client: self, language: language)
131
+ Protocol.new(client: self, language: language)
132
132
  end
133
133
 
134
134
  # @note This method does *not* block
@@ -15,11 +15,7 @@ module DmtdVbmappData
15
15
 
16
16
  # @!attribute [r] chapter_title
17
17
  # @return [String] the title of the chapter
18
- attr_reader :chapter_title
19
-
20
- # @!attribute [r] chapter_short_title
21
- # @return [String] an abbreviated title for the chapter
22
- attr_reader :chapter_short_title
18
+ attr_reader :title
23
19
 
24
20
  # Creates an accessor for the VB-MAPP Guide Chapter on the VB-MAPP Data Server
25
21
  #
@@ -34,8 +30,7 @@ module DmtdVbmappData
34
30
  @chapter_num = opts.fetch(:chapter_num).to_i
35
31
 
36
32
  index_json = opts.fetch(:chapter_index_json)
37
- @chapter_title = index_json[:chapterTitle]
38
- @chapter_short_title = index_json[:chapterShortTitle]
33
+ @title = index_json[:title]
39
34
 
40
35
  @sections_index = index_json[:sections]
41
36
  end
@@ -43,10 +38,10 @@ module DmtdVbmappData
43
38
  # @note This method *does* block as the content is retrieved
44
39
  #
45
40
  # @return [String] The preamble of the Guide's chapter
46
- def chapter_preamble
47
- @chapter_preamble = retrieve_guide_chapter[:chapterPreamble] if @chapter_preamble.nil?
41
+ def content
42
+ @content = retrieve_guide_chapter[:content] if @content.nil?
48
43
 
49
- @chapter_preamble
44
+ @content
50
45
  end
51
46
 
52
47
  # @note This method does *not* block
@@ -19,11 +19,7 @@ module DmtdVbmappData
19
19
 
20
20
  # @!attribute [r]
21
21
  # @return [String] the title of the section
22
- attr_reader :section_title
23
-
24
- # @!attribute [r]
25
- # @return [String] an abbreviated title for the section
26
- attr_reader :section_short_title
22
+ attr_reader :title
27
23
 
28
24
  # Creates an accessor for the VB-MAPP Guide Chapter Section on the VB-MAPP Data Server
29
25
  #
@@ -40,29 +36,16 @@ module DmtdVbmappData
40
36
  @section_num = opts.fetch(:section_num).to_i
41
37
 
42
38
  index_json = opts.fetch(:section_index_json)
43
- @section_title = index_json[:sectionTitle]
44
- @section_short_title = index_json[:sectionShortTitle]
45
- @sub_sections_index = index_json[:subSections]
39
+ @title = index_json[:title]
46
40
  end
47
41
 
48
42
  # @note This method *does* block as the content is retrieved
49
43
  #
50
44
  # @return [String] The content of the Guide's chapter section
51
- def section_content
52
- @section_content = retrieve_guide_section[:sectionContent] if @section_content.nil?
53
-
54
- @section_content
55
- end
56
-
57
- # @note This method does *not* block
58
- #
59
- # @return [Array<GuideSectionSubSection>] The VB-MAPP Guide section's sub_sections
60
- def sub_sections
61
- @sub_sections = @sub_sections_index.map.with_index do |sub_section_index_json, sub_section_num|
62
- GuideSectionSubSection.new(client: client, chapter_num: chapter_num, section_num: section_num, sub_section_num: sub_section_num, sub_section_index_json: sub_section_index_json)
63
- end if @sub_sections.nil?
45
+ def content
46
+ @content = retrieve_guide_section[:content] if @content.nil?
64
47
 
65
- @sub_sections
48
+ @content
66
49
  end
67
50
 
68
51
  private
@@ -2,8 +2,8 @@ require 'dmtd_vbmapp_data/request_helpers'
2
2
 
3
3
  module DmtdVbmappData
4
4
 
5
- # Provides for the retrieving of VB-MAPP content from the VB-MAPP Data Server.
6
- class Vbmapp
5
+ # Provides for the retrieving the Protocol content from the VB-MAPP Data Server.
6
+ class Protocol
7
7
 
8
8
  attr_reader :client
9
9
 
@@ -23,12 +23,12 @@ module DmtdVbmappData
23
23
  # @note The cache is an in-memory cache (not on-disc). Thus, if the process is restarted,
24
24
  # the cache will be dropped. Additionally this cache expires once a day at midnight UTC.
25
25
  #
26
- # @return [Array<VbmappArea>] The entire set of {VbmappArea} instances
26
+ # @return [Array<ProtocolArea>] The entire set of {ProtocolArea} instances
27
27
  def areas
28
28
  index_array = index
29
29
 
30
30
  @areas = index_array.map do |area_index_json|
31
- VbmappArea.new(client: client, area_index_json: area_index_json)
31
+ ProtocolArea.new(client: client, area_index_json: area_index_json)
32
32
  end if @areas.nil? && index_array.is_a?(Array)
33
33
 
34
34
  @areas
@@ -62,11 +62,11 @@ module DmtdVbmappData
62
62
  end
63
63
 
64
64
  def self.end_point
65
- '1/vbmapp/index'
65
+ '1/protocol/index'
66
66
  end
67
67
 
68
68
  def retrieve_vbmapp_index
69
- response = RequestHelpers::get_authorized(end_point: Vbmapp::end_point, params: nil, client_id: @client.id, client_code: @client.code, languge: client.language)
69
+ response = RequestHelpers::get_authorized(end_point: Protocol::end_point, params: nil, client_id: @client.id, client_code: @client.code, languge: client.language)
70
70
  proc_response = RequestHelpers::process_json_response(response)
71
71
  json = proc_response[:json]
72
72
  server_response_code = proc_response[:code]
@@ -2,8 +2,8 @@ require 'dmtd_vbmapp_data/request_helpers'
2
2
 
3
3
  module DmtdVbmappData
4
4
 
5
- # Provides for the retrieving of VB-MAPP area information from the VB-MAPP Data Server.
6
- class VbmappArea
5
+ # Provides for the retrieving of VB-MAPP Protocol Area information from the VB-MAPP Data Server.
6
+ class ProtocolArea
7
7
 
8
8
  # @!attribute [r] client
9
9
  # @return [Client] the associated client
@@ -19,7 +19,7 @@ module DmtdVbmappData
19
19
  #
20
20
  # @option opts [Client] :client A client instance
21
21
  # @option opts [Hash] :area_index_json The vbmapp area index json for the VB-Mapp Area in the format described at
22
- # {https://datamtd.atlassian.net/wiki/pages/viewpage.action?pageId=18710543 /1/vbmapp/index - GET REST api - Area Fields}
22
+ # {https://datamtd.atlassian.net/wiki/pages/viewpage.action?pageId=18710543 /1/protocol/index - GET REST api - Area Fields}
23
23
  def initialize(opts)
24
24
  @client = opts.fetch(:client)
25
25
 
@@ -30,10 +30,10 @@ module DmtdVbmappData
30
30
 
31
31
  # @note This method does *not* block on server access
32
32
  #
33
- # @return [Array<VbmappAreaGroup>] all of the VB-Mapp's {VbmappAreaGroup} instances
33
+ # @return [Array<ProtocolAreaGroup>] all of the VB-Mapp's {ProtocolAreaGroup} instances
34
34
  def groups
35
35
  @groups = @groups_index.map.with_index do |group_index_json, group_num|
36
- VbmappAreaGroup.new(client: client, area: area, group_index_json: group_index_json)
36
+ ProtocolAreaGroup.new(client: client, area: area, group_index_json: group_index_json)
37
37
  end if @groups.nil?
38
38
 
39
39
  @groups
@@ -2,8 +2,8 @@ require 'dmtd_vbmapp_data/request_helpers'
2
2
 
3
3
  module DmtdVbmappData
4
4
 
5
- # Provides for the retrieving of VB-MAPP Guide chapter sections from the VB-MAPP Data Server.
6
- class VbmappAreaGroup
5
+ # Provides for the retrieving of VB-MAPP Protocol Area Group information from the VB-MAPP Data Server.
6
+ class ProtocolAreaGroup
7
7
 
8
8
  # @!attribute [r] client
9
9
  # @return [Client] the associated client
@@ -17,14 +17,14 @@ module DmtdVbmappData
17
17
  # @return [Symbol] the group of the question (e.g. :mand, :tact, :group1, etc.)
18
18
  attr_reader :group
19
19
 
20
- # Creates an accessor for the VB-MAPP Area Group on the VB-MAPP Data Server
20
+ # Creates an accessor for the VB-MAPP Area Group on the VB-MAPP Data Server.
21
21
  #
22
22
  # @note This method does *not* block, simply creates an accessor and returns
23
23
  #
24
24
  # @option opts [Client] :client A client instance
25
25
  # @option opts [String | Symbol] :area The vbmapp area of the group (:milestones, :barriers, :transitions', :eesa)
26
26
  # @option opts [Hash] :group_index_json The vbmapp index json for the group in the format described at
27
- # {https://datamtd.atlassian.net/wiki/pages/viewpage.action?pageId=18710543 /1/vbmapp/index - GET REST api - Group Fields}
27
+ # {https://datamtd.atlassian.net/wiki/pages/viewpage.action?pageId=18710543 /1/protocol/index - GET REST api - Group Fields}
28
28
  def initialize(opts)
29
29
  @client = opts.fetch(:client)
30
30
  @area = opts.fetch(:area).to_sym
@@ -39,12 +39,12 @@ module DmtdVbmappData
39
39
  #
40
40
  # @option opts [String | Symbol] :level Filters the questions to the given level (may be null)
41
41
  #
42
- # @return [Array<VbmappAreaQuestion>] all of the area group's {VbmappAreaQuestion} instances
42
+ # @return [Array<ProtocolAreaQuestion>] all of the area group's {ProtocolAreaQuestion} instances
43
43
  def questions(opts = {})
44
44
  level_name = opts.fetch(:level, nil)
45
45
 
46
46
  @questions = retrieve_questions_json.map do |question_json|
47
- VbmappAreaQuestion.new(client: client, area: area, group: group, question_json: question_json)
47
+ ProtocolAreaQuestion.new(client: client, area: area, group: group, question_json: question_json)
48
48
  end if @questions.nil?
49
49
 
50
50
  if level_name.nil?
@@ -55,7 +55,7 @@ module DmtdVbmappData
55
55
  start_num = level_desc[:start_question_num] + 1 # question_number is 1-based
56
56
  end_num = start_num + level_desc[:question_count]
57
57
 
58
- result = @questions.select {|question| question.question_number >= start_num && question.question_number <= end_num}
58
+ result = @questions.select {|question| question.number >= start_num && question.number <= end_num}
59
59
  end
60
60
 
61
61
  result
@@ -71,7 +71,7 @@ module DmtdVbmappData
71
71
  private
72
72
 
73
73
  def self.end_point
74
- '1/vbmapp/area_question'
74
+ '1/protocol/area_question'
75
75
  end
76
76
 
77
77
  def retrieve_questions_json
@@ -79,7 +79,7 @@ module DmtdVbmappData
79
79
  area: area,
80
80
  group: group
81
81
  }
82
- response = RequestHelpers::get_authorized(end_point: VbmappAreaGroup::end_point, params: params, client_id: @client.id, client_code: @client.code, language: client.language)
82
+ response = RequestHelpers::get_authorized(end_point: ProtocolAreaGroup::end_point, params: params, client_id: @client.id, client_code: @client.code, language: client.language)
83
83
  proc_response = RequestHelpers::process_json_response(response)
84
84
  json = proc_response[:json]
85
85
  server_response_code = proc_response[:code]
@@ -2,8 +2,8 @@ require 'dmtd_vbmapp_data/request_helpers'
2
2
 
3
3
  module DmtdVbmappData
4
4
 
5
- # Provides for the retrieving of VB-MAPP Guide chapter sections from the VB-MAPP Data Server.
6
- class VbmappAreaQuestion
5
+ # Provides for the retrieving of VB-MAPP Area Question on the VB-MAPP Data Server.
6
+ class ProtocolAreaQuestion
7
7
 
8
8
  # @!attribute [r] client
9
9
  # @return [Client] the associated client
@@ -33,17 +33,17 @@ module DmtdVbmappData
33
33
  # @return [String] The objective of the question
34
34
  attr_reader :objective
35
35
 
36
- # @!attribute [r] question_number
36
+ # @!attribute [r] number
37
37
  # @return [Integer] the question number (0...n)
38
- attr_reader :question_number
38
+ attr_reader :number
39
39
 
40
- # @!attribute [r] question_text
40
+ # @!attribute [r] text
41
41
  # @return [String] the text of the question itself
42
- attr_reader :question_text
42
+ attr_reader :text
43
43
 
44
- # @!attribute [r] question_title
44
+ # @!attribute [r] title
45
45
  # @return [String] a title to display at the top of a grid column
46
- attr_reader :question_title
46
+ attr_reader :title
47
47
 
48
48
  # Creates an accessor for the VB-MAPP Area Question on the VB-MAPP Data Server
49
49
  #
@@ -53,7 +53,7 @@ module DmtdVbmappData
53
53
  # @option opts [String | Symbol] :area The vbmapp area of the group ('milestones', 'barriers', 'transitions', 'eesa')
54
54
  # @option opts [String | Symbol] :group The vbmapp area group name (i.e. 'mand', 'tact', 'group1', etc.)
55
55
  # @option opts [Hash] :question_json The vbmapp question json for the question in the format described at
56
- # {https://datamtd.atlassian.net/wiki/pages/viewpage.action?pageId=18710549 /1/vbmapp/area_question - GET REST api - Fields}
56
+ # {https://datamtd.atlassian.net/wiki/pages/viewpage.action?pageId=18710549 /1/protocol/area_question - GET REST api - Fields}
57
57
  def initialize(opts)
58
58
  @client = opts.fetch(:client)
59
59
  @area = opts.fetch(:area).to_sym
@@ -66,15 +66,15 @@ module DmtdVbmappData
66
66
 
67
67
  @example = question_json[:example] || guide_content_json[:examples]
68
68
  @materials = question_json[:materials] || guide_content_json[:materials]
69
- @question_number = question_json[:questionNumber].to_i
70
- @question_text = question_json[:questionText]
71
- @question_title = question_json[:questionTitle] || guide_content_json[:title]
69
+ @number = question_json[:number].to_i
70
+ @text = question_json[:text]
71
+ @title = question_json[:title] || guide_content_json[:title]
72
72
  @responses_json_array = question_json[:responses]
73
73
  end
74
74
 
75
75
  # @note This method does *not* block.
76
76
  #
77
- # @return [Array<VbmappAreaResponse>] all of the VB-MAPP question's possible responses
77
+ # @return [Array<ProtocolAreaResponse>] all of the VB-MAPP question's possible responses
78
78
  def responses
79
79
  if @responses.nil?
80
80
 
@@ -82,7 +82,7 @@ module DmtdVbmappData
82
82
  if @responses_json_array.nil?
83
83
  @responses = client.vbmapp.areas.select { |client_area| client_area.area == area}[0].responses
84
84
  else
85
- @responses = @responses_json_array.map { |response_json| VbmappAreaResponse.new(area: area, response_json: response_json) }
85
+ @responses = @responses_json_array.map { |response_json| ProtocolAreaResponse.new(area: area, response_json: response_json) }
86
86
  end
87
87
  end
88
88
 
@@ -2,8 +2,8 @@ require 'dmtd_vbmapp_data/request_helpers'
2
2
 
3
3
  module DmtdVbmappData
4
4
 
5
- # Provides for the retrieving of VB-MAPP Guide responses from the VB-MAPP Data Server.
6
- class VbmappAreaResponse
5
+ # Provides for the retrieving of VB-MAPP Protocol Area responses from the VB-MAPP Data Server.
6
+ class ProtocolAreaResponse
7
7
 
8
8
  # @!attribute [r] area
9
9
  # @return [Symbol] the area of the question (e.g. :milestones, :barriers, :transitions, :eesa)
@@ -27,7 +27,7 @@ module DmtdVbmappData
27
27
  #
28
28
  # @option opts [String | Symbol] :area The vbmapp area of the group ('milestones', 'barriers', 'transitions', 'eesa')
29
29
  # @option opts [Hash] :response_json The vbmapp question json for the question in the format described at
30
- # {https://datamtd.atlassian.net/wiki/pages/viewpage.action?pageId=18710549 /1/vbmapp/area_question - GET REST api - response}
30
+ # {https://datamtd.atlassian.net/wiki/pages/viewpage.action?pageId=18710549 /1/protocol/area_question - GET REST api - response}
31
31
  def initialize(opts)
32
32
  @area = opts.fetch(:area).to_sym
33
33
 
@@ -1,3 +1,3 @@
1
1
  module DmtdVbmappData
2
- VERSION = '1.1.2'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -9,13 +9,12 @@ require 'dmtd_vbmapp_data/client'
9
9
  require 'dmtd_vbmapp_data/guide'
10
10
  require 'dmtd_vbmapp_data/guide_chapter'
11
11
  require 'dmtd_vbmapp_data/guide_chapter_section'
12
- require 'dmtd_vbmapp_data/guide_section_sub_section'
13
12
 
14
- require 'dmtd_vbmapp_data/vbmapp'
15
- require 'dmtd_vbmapp_data/vbmapp_area'
16
- require 'dmtd_vbmapp_data/vbmapp_area_group'
17
- require 'dmtd_vbmapp_data/vbmapp_area_question'
18
- require 'dmtd_vbmapp_data/vbmapp_area_response'
13
+ require 'dmtd_vbmapp_data/protocol'
14
+ require 'dmtd_vbmapp_data/protocol_area'
15
+ require 'dmtd_vbmapp_data/protocol_area_group'
16
+ require 'dmtd_vbmapp_data/protocol_area_question'
17
+ require 'dmtd_vbmapp_data/protocol_area_response'
19
18
 
20
19
  require 'dmtd_vbmapp_data/assessment_report'
21
20
 
@@ -52,6 +51,6 @@ module DmtdVbmappData
52
51
  @config
53
52
  end
54
53
 
55
- AVAILABLE_LANGUAGES=%w(en es)
54
+ AVAILABLE_LANGUAGES=%w(en) # es)
56
55
 
57
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dmtd_vbmapp_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Hunt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-08 00:00:00.000000000 Z
11
+ date: 2015-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: psych
@@ -119,13 +119,12 @@ files:
119
119
  - lib/dmtd_vbmapp_data/guide.rb
120
120
  - lib/dmtd_vbmapp_data/guide_chapter.rb
121
121
  - lib/dmtd_vbmapp_data/guide_chapter_section.rb
122
- - lib/dmtd_vbmapp_data/guide_section_sub_section.rb
122
+ - lib/dmtd_vbmapp_data/protocol.rb
123
+ - lib/dmtd_vbmapp_data/protocol_area.rb
124
+ - lib/dmtd_vbmapp_data/protocol_area_group.rb
125
+ - lib/dmtd_vbmapp_data/protocol_area_question.rb
126
+ - lib/dmtd_vbmapp_data/protocol_area_response.rb
123
127
  - lib/dmtd_vbmapp_data/request_helpers.rb
124
- - lib/dmtd_vbmapp_data/vbmapp.rb
125
- - lib/dmtd_vbmapp_data/vbmapp_area.rb
126
- - lib/dmtd_vbmapp_data/vbmapp_area_group.rb
127
- - lib/dmtd_vbmapp_data/vbmapp_area_question.rb
128
- - lib/dmtd_vbmapp_data/vbmapp_area_response.rb
129
128
  - lib/dmtd_vbmapp_data/version.rb
130
129
  homepage: https://github.com/foscomputerservices/dmtd_vbmapp_data
131
130
  licenses:
@@ -147,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
146
  version: '0'
148
147
  requirements: []
149
148
  rubyforge_project:
150
- rubygems_version: 2.4.5
149
+ rubygems_version: 2.4.7
151
150
  signing_key:
152
151
  specification_version: 4
153
152
  summary: Ruby gem to simplify access to DMTD's VB-MAPP REST service
@@ -1,86 +0,0 @@
1
- require 'dmtd_vbmapp_data/request_helpers'
2
-
3
- module DmtdVbmappData
4
-
5
- # Provides for the retrieving of VB-MAPP Guide section sub_sections from the VB-MAPP Data Server.
6
- class GuideSectionSubSection
7
-
8
- # @!attribute [r] client
9
- # @return [Client] the associated client
10
- attr_reader :client
11
-
12
- # @!attribute [r] chapter_num
13
- # @return [Integer] the number of the chapter (0..n)
14
- attr_reader :chapter_num
15
-
16
- # @!attribute [r] section_num
17
- # @return [Integer] the number of the section (0..n)
18
- attr_reader :section_num
19
-
20
- # @!attribute [r] sub_section_num
21
- # @return [Integer] the number of the sub-section (0..n)
22
- attr_reader :sub_section_num
23
-
24
- # @!attribute [r] section_title
25
- # @return [String] the title of the sub-section
26
- attr_reader :section_title
27
-
28
- # @!attribute [r] section_short_title
29
- # @return [String] an abbreviated title for the sub-section
30
- attr_reader :section_short_title
31
-
32
- # Creates an accessor for the VB-MAPP Guide Chapter Section on the VB-MAPP Data Server
33
- #
34
- # @note This method does *not* block, simply creates an accessor and returns
35
- #
36
- # @option opts [Client] :client A client instance
37
- # @option opts [Integer] :chapter_num The number (index 0..n) of the chapter in the Guide's index array
38
- # @option opts [Integer] :section_num The number (index 0..n) of the section in the chapter's sections array
39
- # @option opts [Integer] :sub_section_num The number (index 0..n) of the subSection in section's subSections array
40
- # @option opts [Hash] :sub_section_index_json The guide index json for the subSection in the format described at
41
- # {https://datamtd.atlassian.net/wiki/pages/viewpage.action?pageId=18710558 1/guide/index REST api - SubSection Fields}
42
- def initialize(opts)
43
- @client = opts.fetch(:client)
44
- @chapter_num = opts.fetch(:chapter_num).to_i
45
- @section_num = opts.fetch(:section_num).to_i
46
- @sub_section_num = opts.fetch(:sub_section_num).to_i
47
-
48
- sub_section_index_json = opts.fetch(:sub_section_index_json)
49
- @section_title = sub_section_index_json[:sectionTitle]
50
- @section_short_title = sub_section_index_json[:sectionShortTitle]
51
- end
52
-
53
- # @note This method *does* block as the content is retrieved
54
- #
55
- # @return [String] The content of the Guide's sub section
56
- def section_content
57
- retrieve_guide_sub_section[:sectionContent]
58
- end
59
-
60
- private
61
-
62
- def self.end_point
63
- '1/guide/sub_section'
64
- end
65
-
66
- def retrieve_guide_sub_section
67
- if @guide_sub_section.nil?
68
- params = {
69
- chapter_num: chapter_num,
70
- section_num: section_num,
71
- sub_section_num: sub_section_num
72
- }
73
- response = RequestHelpers::get_authorized(end_point: GuideSectionSubSection::end_point, params: params, client_id: @client.id, client_code: @client.code, language: client.language)
74
- proc_response = RequestHelpers::process_json_response(response)
75
- json = proc_response[:json]
76
- server_response_code = proc_response[:code]
77
-
78
- @guide_sub_section = json
79
- # result = server_response_code if json.nil?
80
- end
81
-
82
- @guide_sub_section
83
- end
84
- end
85
-
86
- end