Sha256: 7c81c8a91f121179ea8d14c6744194fcd51409a7a319adfe081b54c1552d8492

Contents?: true

Size: 639 Bytes

Versions: 1

Compression:

Stored size: 639 Bytes

Contents

require 'classes/resource'

module PCR
  class Review
    include PCR::Resource
    attr_reader :instructor, :num_reviewers, :num_students, :retrieved,
                :comments, :id

    def initialize(path)
      @path = path

      # Hit api
      json = PCR.get_json(path)

      # Assign attrs
      attrs = %w(instructor num_reviewers num_students amount_learned comments
                retrieved id)
      set_attrs(attrs, json)

      # Assign ratings
      json['result']['ratings'].each do |name, val|
        self.instance_variable_set("@#{name}", val)
        self.class.send(:attr_accessor, name)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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