Class: UWAPI::API
- Inherits:
-
Object
show all
- Includes:
- Course, Event, ExamInfo, Experimental, FacultyInfo, FoodServices, Geolocation, Other, Professor, Schedule, Weather, WirelessData
- Defined in:
- lib/uwapi.rb
Instance Method Summary
collapse
included
#call_with_q, #call_without_q
Constructor Details
#initialize(args) ⇒ API
Returns a new instance of API.
51
52
53
54
55
56
57
58
59
|
# File 'lib/uwapi.rb', line 51
def initialize(args)
if args.include?(:api_key)
@api_key = args[:api_key]
else
raise ArgumentError, ':api_key is required. See http://api.uwaterloo.ca/'
end
@api_format = args[:api_format] if args.include?(:api_format)
raise ArgumentError, ':api_format must be one of [json, xml]' unless ['json', 'xml'].include?(api_format)
end
|
Instance Method Details
61
62
63
|
# File 'lib/uwapi.rb', line 61
def api_format
@api_format ||= 'json'
end
|
#api_key ⇒ Object
69
70
71
|
# File 'lib/uwapi.rb', line 69
def api_key
@api_key
end
|
#api_url ⇒ Object
65
66
67
|
# File 'lib/uwapi.rb', line 65
def api_url
'http://api.uwaterloo.ca/public/v1/'
end
|