Class: PCR

Inherits:
Object
  • Object
show all
Defined in:
lib/pcr-ruby.rb

Overview

PCR class handles token and api url, so both are easily changed

Direct Known Subclasses

Course, CourseHistory, Section

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token, api_endpt = "http://api.penncoursereview.com/v1/") ⇒ PCR

Returns a new instance of PCR.



8
9
10
11
# File 'lib/pcr-ruby.rb', line 8

def initialize(token, api_endpt = "http://api.penncoursereview.com/v1/")
  @token = token
  @api_endpt = api_endpt
end

Instance Attribute Details

#api_endptObject

Returns the value of attribute api_endpt.



6
7
8
# File 'lib/pcr-ruby.rb', line 6

def api_endpt
  @api_endpt
end

#tokenObject

Returns the value of attribute token.



6
7
8
# File 'lib/pcr-ruby.rb', line 6

def token
  @token
end

Instance Method Details

#coursehistory(course_code) ⇒ Object



13
14
15
# File 'lib/pcr-ruby.rb', line 13

def coursehistory(course_code)
  CourseHistory.new(course_code, self.api_endpt, self.token)
end

#makeURL(path) ⇒ Object

end



21
22
23
# File 'lib/pcr-ruby.rb', line 21

def makeURL(path)
  "#{self.api_endpt + path}?token=#{self.token}"
end