Class: TIES::Schools

Inherits:
Base
  • Object
show all
Defined in:
lib/ties/schools.rb

Instance Attribute Summary

Attributes inherited from Base

#api_key, #district_number, #endpoint, #secret_key, #total_count, #total_pages

Instance Method Summary collapse

Methods inherited from Base

#all, #authentication, #classes, #each, #reimbursements, #requested_classes, #schools, #send_request, #students, #teachers

Constructor Details

#initialize(ties) ⇒ Schools

Returns a new instance of Schools.



2
3
4
# File 'lib/ties/schools.rb', line 2

def initialize(ties)
  @ties = ties
end

Instance Method Details

#get(page = 1, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/ties/schools.rb', line 5

def get(page = 1, options = {})
  options.merge!({"DistrictNumber" => @ties.district_number})
  result = @ties.send_request('Schools/%i' % page, options)
  return [] unless result
  self.total_pages = result['TotalPages']
  self.total_count = result['TotalCount']
  return result['Return']
end