Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
schedules
Commits
9f414f1f
Commit
9f414f1f
authored
Sep 26, 2018
by
Zach Perkins
Browse files
Made the course listing endpoint plural
parent
d86148c2
Changes
5
Hide whitespace changes
Inline
Side-by-side
schedules/app/controllers/course_listing_controller.rb
→
schedules/app/controllers/course_listing
s
_controller.rb
View file @
9f414f1f
class
CourseListingController
<
ApplicationController
class
CourseListing
s
Controller
<
ApplicationController
resource_description
do
short
'Working with courses and associated sections'
end
api
:GET
,
'/course_listing'
,
"Get all available courses and their sections"
api
:GET
,
'/course_listing
s
'
,
"Get all available courses and their sections"
param
:subject
,
String
,
desc:
'Course subject, e.g. "CS" or "ACCT"'
param
:number
,
Integer
,
desc:
'Course number, e.g. "112"'
def
index
...
...
schedules/app/controllers/course_sections_controller.rb
View file @
9f414f1f
...
...
@@ -5,7 +5,7 @@ class CourseSectionsController < ApplicationController
short
'Working with course sections, e.g. CS 112 001'
end
api
:GET
,
'/course
s
_sections'
,
'Get a list of course sections'
api
:GET
,
'/course_sections'
,
'Get a list of course sections'
param
:course_id
,
Integer
,
desc:
"Only get the course sections belonging to the course with this ID"
param
:crn
,
String
,
desc:
"Get the course section with this CRN"
param
:instructor
,
String
,
desc:
"Get course sections being taught by this instructor"
...
...
schedules/config/routes.rb
View file @
9f414f1f
...
...
@@ -6,7 +6,7 @@ Rails.application.routes.draw do
scope
:api
do
# Register /api routes
resources
:courses
,
only:
[
:index
,
:show
,
:listing
]
resources
:course_sections
,
only:
[
:index
]
resources
:course_listing
,
only:
[
:index
]
resources
:course_listing
s
,
only:
[
:index
]
resources
:schedules
,
only:
[
:index
]
end
...
...
schedules/test/controllers/course_listing_controller_test.rb
deleted
100644 → 0
View file @
d86148c2
require
'test_helper'
class
CourseListingControllerTest
<
ActionDispatch
::
IntegrationTest
# test "the truth" do
# assert true
# end
end
schedules/test/controllers/course_listings_controller_test.rb
0 → 100644
View file @
9f414f1f
require
'test_helper'
class
CourseListingsControllerTest
<
ActionDispatch
::
IntegrationTest
test
'should grab sections for course'
do
get
course_listings_url
course_id:
courses
(
:cs112
).
id
assert_response
:success
listing_returned
=
JSON
.
parse
@response
.
body
assert
listing_returned
.
size
.
positive?
assert
listing_returned
[
0
].
include?
(
"sections"
)
assert_equal
(
listing_returned
[
0
][
"sections"
].
length
(),
2
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment