Module: Spear::Structure::Application::EmbededClass

Included in:
Blank, State
Defined in:
lib/spear/structure/application/embeded_class.rb

Defined Under Namespace

Classes: ApplicationObject, Question

Instance Method Summary collapse

Instance Method Details

#generate_apps(apps) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/spear/structure/application/embeded_class.rb', line 44

def generate_apps(apps)
  if !apps.nil?
    if apps.kind_of?(Array)
      apps.map {|app|
        ApplicationObject.new(app['ApplicationDID'], app['Viewed'], app['ViewedDate'])
      }
    else # Hash
      [] << ApplicationObject.new(apps['ApplicationDID'], apps['Viewed'], apps['ViewedDate'])
    end
  else
    []
  end
end

#generate_questions(questions) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/spear/structure/application/embeded_class.rb', line 19

def generate_questions(questions)
  if !questions.nil?
    if questions.kind_of?(Array)
      questions.map {|q|
        Question.new(q['QuestionID'], q['QuestionType'], q['IsRequired'], q['QuestionText'])
      }
    else # Hash
      [] << Question.new(questions['QuestionID'],
        questions['QuestionType'], questions['IsRequired'], questions['QuestionText'])
    end
  else
    []
  end
end