Class: Cb::Models::ApplicationSchema::QuestionSchema

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ QuestionSchema

Returns a new instance of QuestionSchema.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/cb/models/implementations/application_schema.rb', line 42

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 << ApplicationSchema::AnswerSchema.new(aa)
      end
    end
  end
end

Instance Attribute Details

#answersObject

Returns the value of attribute answers.



40
41
42
# File 'lib/cb/models/implementations/application_schema.rb', line 40

def answers
  @answers
end

#formatObject

Returns the value of attribute format.



40
41
42
# File 'lib/cb/models/implementations/application_schema.rb', line 40

def format
  @format
end

#idObject

Returns the value of attribute id.



40
41
42
# File 'lib/cb/models/implementations/application_schema.rb', line 40

def id
  @id
end

#requiredObject

Returns the value of attribute required.



40
41
42
# File 'lib/cb/models/implementations/application_schema.rb', line 40

def required
  @required
end

#textObject

Returns the value of attribute text.



40
41
42
# File 'lib/cb/models/implementations/application_schema.rb', line 40

def text
  @text
end

#typeObject

Returns the value of attribute type.



40
41
42
# File 'lib/cb/models/implementations/application_schema.rb', line 40

def type
  @type
end