lib/pcr-ruby.rb in pcr-ruby-0.2.1 vs lib/pcr-ruby.rb in pcr-ruby-0.5
- old
+ new
@@ -1,28 +1,28 @@
require 'json'
require 'open-uri'
-require 'time'
-require 'csv'
-
#PCR class handles token and api url, so both are easily changed
class PCR
+ attr_accessor :token, :api_endpt
+
def initialize(token, api_endpt = "http://api.penncoursereview.com/v1/")
- @@token = token
- @@api_endpt = api_endpt
+ @token = token
+ @api_endpt = api_endpt
end
- def course(course_code)
- Course.new(course_code)
+ def coursehistory(course_code)
+ CourseHistory.new(course_code, self.api_endpt, self.token)
end
- def section(id, hit_api = true)
- Section.new(id, hit_api)
- end
+ # def instructor(id)
+ # Instructor.new(id)
+ # end
- def instructor(id)
- Instructor.new(id)
+ def makeURL(path)
+ "#{self.api_endpt + path}?token=#{self.token}"
end
+
end
# Load classes
Dir[File.dirname(__FILE__) + "/classes/*.rb"].each { |file| require file }
\ No newline at end of file