Class: PCR
- Inherits:
-
Object
- Object
- PCR
- Defined in:
- lib/pcr-ruby.rb
Overview
PCR class handles token and api url, so both are easily changed
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api_endpt ⇒ Object
Returns the value of attribute api_endpt.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #coursehistory(course_code) ⇒ Object
-
#initialize(token, api_endpt = "http://api.penncoursereview.com/v1/") ⇒ PCR
constructor
A new instance of PCR.
-
#makeURL(path) ⇒ Object
end.
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_endpt ⇒ Object
Returns the value of attribute api_endpt.
6 7 8 |
# File 'lib/pcr-ruby.rb', line 6 def api_endpt @api_endpt end |
#token ⇒ Object
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 |