Class: DmtdVbmappData::ProtocolAreaQuestion
- Inherits:
-
Object
- Object
- DmtdVbmappData::ProtocolAreaQuestion
- Defined in:
- lib/dmtd_vbmapp_data/protocol_area_question.rb
Overview
Provides for the retrieving of VB-MAPP Area Question on the VB-MAPP Data Server.
Instance Attribute Summary collapse
-
#area ⇒ Object
readonly
Returns the value of attribute area.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#example ⇒ Object
readonly
Returns the value of attribute example.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#materials ⇒ Object
readonly
Returns the value of attribute materials.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#objective ⇒ Object
readonly
Returns the value of attribute objective.
-
#skills ⇒ Object
readonly
Returns the value of attribute skills.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(opts) ⇒ ProtocolAreaQuestion
constructor
Creates an accessor for the VB-MAPP Area Question on the VB-MAPP Data Server.
-
#responses ⇒ Array<ProtocolAreaResponse>
All of the VB-MAPP question’s possible responses.
Constructor Details
#initialize(opts) ⇒ ProtocolAreaQuestion
This method does not block, simply creates an accessor and returns
Creates an accessor for the VB-MAPP Area Question on the VB-MAPP Data Server
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 65 def initialize(opts) @client = opts.fetch(:client) @area = opts.fetch(:area).to_sym @group = opts.fetch(:group).to_sym question_json = opts.fetch(:question_json) @definition = question_json[:definition] @objective = question_json[:objective] @example = question_json[:example] @materials = question_json[:materials] @number = question_json[:number].to_i @text = question_json[:text] @title = question_json[:title] @level = question_json[:level] @responses_json_array = question_json[:responses] skills = question_json[:skills] @skills = if skills.nil? [] else question_json[:skills].map do |skill| ProtocolAreaSkill.new(question_json: skill) end end end |
Instance Attribute Details
#area ⇒ Object (readonly)
Returns the value of attribute area.
14 15 16 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 14 def area @area end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
10 11 12 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 10 def client @client end |
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
22 23 24 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 22 def definition @definition end |
#example ⇒ Object (readonly)
Returns the value of attribute example.
26 27 28 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 26 def example @example end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
18 19 20 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 18 def group @group end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
50 51 52 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 50 def level @level end |
#materials ⇒ Object (readonly)
Returns the value of attribute materials.
30 31 32 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 30 def materials @materials end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
38 39 40 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 38 def number @number end |
#objective ⇒ Object (readonly)
Returns the value of attribute objective.
34 35 36 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 34 def objective @objective end |
#skills ⇒ Object (readonly)
Returns the value of attribute skills.
54 55 56 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 54 def skills @skills end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
42 43 44 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 42 def text @text end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
46 47 48 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 46 def title @title end |
Instance Method Details
#responses ⇒ Array<ProtocolAreaResponse>
This method does not block.
Returns all of the VB-MAPP question’s possible responses.
94 95 96 97 98 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 94 def responses @responses = @responses_json_array.map { |response_json| ProtocolAreaResponse.new(area: area, response_json: response_json) } if @responses.nil? @responses end |