Sha256: 2c0960e1236c0a570c3d29412a5888cd70045d78140563d8a20a26549622f042

Contents?: true

Size: 1.41 KB

Versions: 6

Compression:

Stored size: 1.41 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,
                                            headers
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
clever-ruby-0.11.1 lib/clever-ruby/district.rb
clever-ruby-0.11.0 lib/clever-ruby/district.rb
clever-ruby-0.10.2 lib/clever-ruby/district.rb
clever-ruby-0.10.1 lib/clever-ruby/district.rb
clever-ruby-0.10.0 lib/clever-ruby/district.rb
clever-ruby-0.9.0 lib/clever-ruby/district.rb