Sha256: 363304fde3abded0ccb599b4ecdd4027c2f68253e89ab8961a07b7811b173829

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

module Eleyo
  module API
    class Student < Account

      def lookup_district_student_id(params)
        # accepted lookup attributes
        # firstname & lastname & birthdate
        # state_student_id
        request = HTTPI::Request.new
        request.url = "#{self.class.server_uri}/api/v1/students/lookup/district_student_id/#{URI.escape(self.auth.district_subdomain)}"
        request.query = params
        request.headers = self.generate_headers

        response = HTTPI.get(request)

        if !response.error?
          JSON.parse(response.body)
        else
          raise(API::Error.new(response.code, response.body))
        end
      end

      def lookup_state_student_id(params)
        # accepted lookup attributes
        # firstname & lastname & birthdate
        # district_student_id
        request = HTTPI::Request.new
        request.url = "#{self.class.server_uri}/api/v1/students/lookup/state_student_id/#{URI.escape(self.auth.district_subdomain)}"
        request.query = params
        request.headers = self.generate_headers

        response = HTTPI.get(request)

        if !response.error?
          JSON.parse(response.body)
        else
          raise(API::Error.new(response.code, response.body))
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eleyo-1.2.1 lib/eleyo/api/student.rb
eleyo-1.2.0 lib/eleyo/api/student.rb