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.
-
#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
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 61 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] 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 |
#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.
81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/dmtd_vbmapp_data/protocol_area_question.rb', line 81 def responses if @responses.nil? # If we don't have responses, get them from the area if @responses_json_array.nil? @responses = client.vbmapp.areas.select { |client_area| client_area.area == area}[0].responses else @responses = @responses_json_array.map { |response_json| ProtocolAreaResponse.new(area: area, response_json: response_json) } end end @responses end |