Sha256: 20c05e8f6ab9261897256d36b502e4b2124b777949f5298b09f6ee1aabd86c2b

Contents?: true

Size: 746 Bytes

Versions: 1

Compression:

Stored size: 746 Bytes

Contents

require 'classes/resource'
require 'classes/review'

module PCR
  class Section
    include PCR::Resource
    attr_reader :aliases, :course, :group, :id, :instructors, 
                  :meetingtimes, :name, :path, :reviews, 
                  :sectionnum, :retrieved, :valid, :version

    def initialize(path)
      @path = path

      # Hit api
      json = PCR.get_json(path)

      # Get reviews
      # Usually one, but may be > 1
      @reviews = json['result']['reviews']['values'].map do |review|
        Review.new(review['path'])
      end

      # Assign attrs
      attrs = %w(aliases course group id instructors meetingtimes name 
                 sectionnum retrieved valid version)
      set_attrs(attrs, json)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pcr-0.5 lib/classes/section.rb