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
S
schedules
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
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
Khalid Ali
schedules
Commits
ff7fe3f4
Commit
ff7fe3f4
authored
Sep 04, 2018
by
Zac Wood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed broken validators
parent
f057e725
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
4 deletions
+24
-4
schedules_api/app/controllers/course_sections_controller.rb
schedules_api/app/controllers/course_sections_controller.rb
+1
-1
schedules_api/app/controllers/courses_controller.rb
schedules_api/app/controllers/courses_controller.rb
+1
-2
schedules_api/app/controllers/schedules_controller.rb
schedules_api/app/controllers/schedules_controller.rb
+1
-1
schedules_api/config/initializers/apipie_validators.rb
schedules_api/config/initializers/apipie_validators.rb
+21
-0
No files found.
schedules_api/app/controllers/course_sections_controller.rb
View file @
ff7fe3f4
...
...
@@ -6,7 +6,7 @@ class CourseSectionsController < ApplicationController
end
api
:GET
,
'/courses_sections'
,
'Get a list of course sections'
param
:course_id
,
Fixnum
,
desc:
"Only get the course sections belonging to the course with this ID"
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"
def
index
@sections
=
CourseSection
.
all
...
...
schedules_api/app/controllers/courses_controller.rb
View file @
ff7fe3f4
...
...
@@ -6,7 +6,7 @@ class CoursesController < ApplicationController
api
:GET
,
'/courses'
,
"Get a list of courses."
param
:subject
,
String
,
desc:
'Course subject, e.g. "CS" or "ACCT"'
param
:course_number
,
:numb
er
,
desc:
'Course number, e.g. "112"'
param
:course_number
,
Integ
er
,
desc:
'Course number, e.g. "112"'
def
index
@courses
=
Course
.
all
...
...
@@ -17,7 +17,6 @@ class CoursesController < ApplicationController
render
json:
@courses
end
# Renders JSON of details of a singluar course, such as its sections
api
:GET
,
'/courses/:id'
,
"Get a list of all course sections for the course with the given id."
param
:id
,
:number
,
desc:
'Course ID'
,
required:
true
def
show
...
...
schedules_api/app/controllers/schedules_controller.rb
View file @
ff7fe3f4
...
...
@@ -9,7 +9,7 @@ class SchedulesController < ApplicationController
# Render an iCal file containing the schedules of all the
# course sections with the given CRNs.
api
:GET
,
'/schedules'
,
'Generate an iCal file with events for the given CRNs'
param
:crns
,
Array
,
of:
String
,
desc:
'Array
of CRNs to include as events in the calendar'
,
required:
true
param
:crns
,
String
,
desc:
'Comma separated list
of CRNs to include as events in the calendar'
,
required:
true
def
index
crns
=
params
[
"crns"
].
split
','
@schedule
=
Schedule
.
new
crns
...
...
schedules_api/config/initializers/apipie_validators.rb
0 → 100644
View file @
ff7fe3f4
class
IntegerValidator
<
Apipie
::
Validator
::
BaseValidator
def
initialize
(
param_description
,
argument
)
super
(
param_description
)
@type
=
argument
end
def
validate
(
value
)
return
false
if
value
.
nil?
!!
(
value
.
to_s
=~
/^[-+]?[0-9]+$/
)
en
d
def
self
.
build
(
param_description
,
argument
,
options
,
block
)
if
argument
==
Integer
self
.
new
(
param_description
,
argument
)
end
end
def
description
"Must be
#{
@type
}
."
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