Class: Cb::CbApplicationSchema

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

Overview

This general purpose object stores anything having to do with an application. The API objects dealing with application, will populate one or many of this object.

Defined Under Namespace

Classes: CbAnswerSchema, CbQuestionSchema

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ CbApplicationSchema



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cb/models/cb_application_schema.rb', line 12

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

  # Job Info related
  @did                      = args['JobDID'] || ''
  @title                     = args['JobTitle'] || ''
    @requirements             = args['Requirements'] || ''

  # Apply URL related
  @submit_service_url       = args['ApplicationSubmitServiceURL'] || ''
  @apply_url                 = args['ApplyURL'] || ''
    @is_shared_apply          = (args['IsSharedApply'].downcase == 'true')

  # Question related
  @total_questions           = args['TotalQuestions'] || ''
  @total_required_questions  = args['TotalRequiredQuestions'] || ''
    @total_questions          = @total_questions.to_i if Cb::Utils::Api.is_numeric? @total_questions
    @total_required_questions = @total_required_questions.to_i if Cb::Utils::Api.is_numeric? @total_required_questions

    @questions = []
    if args.has_key?('Questions')
      unless args['Questions'].empty?
        args['Questions']['Question'].each do | qq |
          @questions << CbApplicationSchema::CbQuestionSchema.new(qq)
        end
      end
    end
end

Instance Attribute Details

#apply_urlObject

Returns the value of attribute apply_url.



8
9
10
# File 'lib/cb/models/cb_application_schema.rb', line 8

def apply_url
  @apply_url
end

#didObject

Returns the value of attribute did.



8
9
10
# File 'lib/cb/models/cb_application_schema.rb', line 8

def did
  @did
end

#is_shared_applyObject

Returns the value of attribute is_shared_apply.



8
9
10
# File 'lib/cb/models/cb_application_schema.rb', line 8

def is_shared_apply
  @is_shared_apply
end

#questionsObject

Returns the value of attribute questions.



8
9
10
# File 'lib/cb/models/cb_application_schema.rb', line 8

def questions
  @questions
end

#requirementsObject

Returns the value of attribute requirements.



8
9
10
# File 'lib/cb/models/cb_application_schema.rb', line 8

def requirements
  @requirements
end

#submit_service_urlObject

Returns the value of attribute submit_service_url.



8
9
10
# File 'lib/cb/models/cb_application_schema.rb', line 8

def submit_service_url
  @submit_service_url
end

#titleObject

Returns the value of attribute title.



8
9
10
# File 'lib/cb/models/cb_application_schema.rb', line 8

def title
  @title
end

#total_questionsObject

Returns the value of attribute total_questions.



8
9
10
# File 'lib/cb/models/cb_application_schema.rb', line 8

def total_questions
  @total_questions
end

#total_required_questionsObject

Returns the value of attribute total_required_questions.



8
9
10
# File 'lib/cb/models/cb_application_schema.rb', line 8

def total_required_questions
  @total_required_questions
end