Module: Openapply::GetOneStudent

Included in:
Client
Defined in:
lib/openapply/get_one_student.rb

Instance Method Summary collapse

Instance Method Details

#one_student_details_by_id(id, options = {}) ⇒ Object

Note:

Get all student details matching the associated id

Parameters:

  • ids
    • (Integer) - ids of student to lookup

  • options (:get_payments) (defaults to: {})

    (Boolean) - get student payments (or not)



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/openapply/get_one_student.rb', line 9

def one_student_details_by_id( id, options={} )
  get_payments = options[:get_payments]  unless options.nil? or options.empty?
  get_payments ||= true  if get_payments.nil?
  student_info = one_student_record_by_id( "#{id}" )

  return {student: {id: id, empty: []}}      if student_info.nil? or
                                                student_info[:student].nil?
                                                student_info[:student].empty?
  student = []
  student = student_info[:student]       unless student_info[:student].nil?
  guardians = []
  guardians = student_info[:linked][:parents].dup unless
                                                student_info[:linked].nil? or
                                                student_info[:linked].empty? or
                                                student_info[:linked][:parents].nil?
  payments = []
  payment_info = one_student_payments_by_id("#{id}") if get_payments.eql? true
  payments = payment_info[:payments].dup unless payment_info.nil? or
                                                payment_info[:payments].nil?
  return  { student: {  id: id,
                        record: student,
                        payments: payments,
                        guardians: guardians,
                      },
            guardians: guardians,
          }
end

#one_student_payments_by_id(id, options = {}) ⇒ Object

Note:

Get one student’s details matching the associated id

Parameters:

  • ids
    • (Integer) - ids of student to lookup

  • options (defaults to: {})
    • http options



48
49
50
51
# File 'lib/openapply/get_one_student.rb', line 48

def one_student_payments_by_id(id, options={})
  url = "#{api_path}#{id}/payments?auth_token=#{api_key}"
  return oa_answer( url, options )
end

#one_student_record_by_id(id, options = {}) ⇒ Object

Note:

Get one student’s primary record matching the associated id

Parameters:

  • ids
    • (Integer) - ids of student to lookup

  • options (defaults to: {})
    • http options



40
41
42
43
# File 'lib/openapply/get_one_student.rb', line 40

def one_student_record_by_id(id, options ={})
  url = "#{api_path}#{id}?auth_token=#{api_key}"
  return oa_answer( url, options )
end