lib/pcr-ruby.rb in pcr-ruby-0.0.2 vs lib/pcr-ruby.rb in pcr-ruby-0.0.3
- old
+ new
@@ -94,13 +94,25 @@
end
#API class handles token and api url, so both are easily changed
class API
attr_accessor :token, :api_endpt
- def initialize()
- @token = File.open(File.join(File.dirname(__FILE__), '..', 'token.dat', &:readline)
+ def initialize(token)
+ @token = token
@api_endpt = "http://api.penncoursereview.com/v1/"
end
+
+ def course(args)
+ Course.new(args)
+ end
+
+ def section(args)
+ Section.new(args)
+ end
+
+ def instructor(id, args)
+ Instructor.new(id, args)
+ end
end
#These errors serve as more specific exceptions so we know where exactly errors are coming from.
class CourseError < StandardError
end
\ No newline at end of file