Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
schedules
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
11
Issues
11
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SRCT
schedules
Commits
43791089
Commit
43791089
authored
Feb 10, 2019
by
Zac Wood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Semesters endpoint to API
parent
a3f53830
Pipeline
#3849
failed with stage
in 2 minutes and 45 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
1 deletion
+24
-1
schedules/app/controllers/api/semesters_controller.rb
schedules/app/controllers/api/semesters_controller.rb
+13
-0
schedules/app/helpers/api/semesters_helper.rb
schedules/app/helpers/api/semesters_helper.rb
+2
-0
schedules/config/routes.rb
schedules/config/routes.rb
+1
-0
schedules/db/seeds.rb
schedules/db/seeds.rb
+1
-1
schedules/test/controllers/api/semesters_controller_test.rb
schedules/test/controllers/api/semesters_controller_test.rb
+7
-0
No files found.
schedules/app/controllers/api/semesters_controller.rb
0 → 100644
View file @
43791089
class
API::SemestersController
<
ApplicationController
def
index
result
=
Semester
.
all
.
map
do
|
s
|
{
id:
s
.
id
,
season:
s
.
season
,
year:
s
.
year
}
end
render
json:
result
end
end
schedules/app/helpers/api/semesters_helper.rb
0 → 100644
View file @
43791089
module
API::SemestersHelper
end
schedules/config/routes.rb
View file @
43791089
...
...
@@ -12,6 +12,7 @@ Rails.application.routes.draw do
get
'schedule/view'
,
to:
'schedules#view'
,
as:
'view_schedule'
scope
:api
,
module:
'api'
do
# Register /api routes
resources
:semesters
,
only:
[
:index
],
as:
'api_semesters'
resources
:courses
,
only:
[
:index
,
:show
],
as:
'api_courses'
resources
:course_sections
,
only:
[
:index
],
as:
'api_course_sections'
resources
:instructors
,
only:
[
:index
,
:show
],
as:
'api_instructors'
...
...
schedules/db/seeds.rb
View file @
43791089
...
...
@@ -116,7 +116,7 @@ def main
[
parser
.
parse_semesters
.
first
]
else
# expand to include however many semesters you want
parser
.
parse_semesters
[
0
..
2
]
parser
.
parse_semesters
[
0
..
6
]
end
...
...
schedules/test/controllers/api/semesters_controller_test.rb
0 → 100644
View file @
43791089
require
'test_helper'
class
API::SemestersControllerTest
<
ActionDispatch
::
IntegrationTest
# test "the truth" do
# assert true
# 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