Class: Cb::CbApplicationSchema::CbQuestionSchema

Inherits:
Object
  • Object
show all
Defined in:
lib/cb/models/cb_application_schema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ CbQuestionSchema



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/cb/models/cb_application_schema.rb', line 46

def initialize(args = {})
  return if args.nil?

  @id       = args['QuestionID'] || ''
  @type     = args['QuestionType'] || ''
  @required = (args['IsRequired'].downcase == 'true')
  @format   = args['ExpectedResponseFormat'] || ''
  @text     = args['QuestionText'] || ''

  @answers = []
  if args.has_key?('Answers')
    unless args['Answers'].empty?
      args['Answers']['Answer'].each do | aa |
        @answers << CbApplicationSchema::CbAnswerSchema.new(aa)
      end
    end
  end
end

Instance Attribute Details

#answersObject

Returns the value of attribute answers.



44
45
46
# File 'lib/cb/models/cb_application_schema.rb', line 44

def answers
  @answers
end

#formatObject

Returns the value of attribute format.



44
45
46
# File 'lib/cb/models/cb_application_schema.rb', line 44

def format
  @format
end

#idObject

Returns the value of attribute id.



44
45
46
# File 'lib/cb/models/cb_application_schema.rb', line 44

def id
  @id
end

#requiredObject

Returns the value of attribute required.



44
45
46
# File 'lib/cb/models/cb_application_schema.rb', line 44

def required
  @required
end

#textObject

Returns the value of attribute text.



44
45
46
# File 'lib/cb/models/cb_application_schema.rb', line 44

def text
  @text
end

#typeObject

Returns the value of attribute type.



44
45
46
# File 'lib/cb/models/cb_application_schema.rb', line 44

def type
  @type
end