Sha256: e600c97f3638e54b3f9c1f10f5defcbb133b93e78c3d1ccf11a7df177460295a

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

module Clever
  # District resource
  class District < APIResource
    include Clever::APIOperations::List
    @linked_resources = [:schools, :teachers, :sections, :students, :events]

    # Get admins for the current district
    # @todo This is not implemented!
    # @api public
    # @raise [NotImplementedError]
    # @return [Object]
    # @example
    #   district = district.retrieve id
    #   admins = district.admins
    def admins
      fail NotImplementedError, 'admins nested resource not yet implemented.'
    end

    # Get status of the current district
    # @todo This is not implemented!
    # @api public
    # @raise [NotImplementedError]
    # @return [Object]
    # @example
    #   district = district.retrieve id
    #   puts district.status
    def status
      fail NotImplementedError, 'status nested resource not yet implemented.'
    end

    # @see Clever::CleverObject.optional_attributes
    # @api private
    # @return [Array]
    def optional_attributes
      # All of a district's attributes are required.
      []
    end

    # TODO: remove
    [:school_pages, :teacher_pages, :section_pages, :student_pages, :event_pages].each do |name|
      define_method(name) do |filters = {}|
        Clever::APIOperations::PageList.new get_link_uri(name.to_s.gsub('_page', '')), filters
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
clever-ruby-0.8.0 lib/clever-ruby/district.rb
clever-ruby-0.7.0 lib/clever-ruby/district.rb