class Cb::Models::Application::Question
Attributes
answers[R]
expected_response_format[R]
is_required[R]
max_characters[R]
min_characters[R]
question_id[R]
question_text[R]
question_type[R]
Protected Instance Methods
extracted_answers()
click to toggle source
# File lib/cb/models/implementations/application/form.rb, line 80 def extracted_answers answers = iterable_answers? ? response_answers : [] answers.map { |answer_hash| Answer.new(answer_hash) } end
extracted_int_or_nil(key)
click to toggle source
# File lib/cb/models/implementations/application/form.rb, line 93 def extracted_int_or_nil(key) api_response.key?(key) ? api_response[key].to_i : nil end
iterable_answers?()
click to toggle source
# File lib/cb/models/implementations/application/form.rb, line 85 def iterable_answers? !response_answers.nil? && !response_answers.empty? && response_answers.respond_to?(:map) end
required_fields()
click to toggle source
# File lib/cb/models/implementations/application/form.rb, line 65 def required_fields %w(ExpectedResponseFormat IsRequired QuestionID QuestionText QuestionType Answers) end
response_answers()
click to toggle source
# File lib/cb/models/implementations/application/form.rb, line 89 def response_answers api_response['Answers'] end
set_model_properties()
click to toggle source
# File lib/cb/models/implementations/application/form.rb, line 69 def set_model_properties @is_required = api_response['IsRequired'] @question_id = api_response['QuestionID'] @question_text = api_response['QuestionText'] @question_type = api_response['QuestionType'] @answers = extracted_answers @min_characters = extracted_int_or_nil('minCharacters') @max_characters = extracted_int_or_nil('maxCharacters') @expected_response_format = api_response['ExpectedResponseFormat'] end