Skip to content

Instantly share code, notes, and snippets.

@gabrielgilini
Created October 17, 2014 20:09
Show Gist options
  • Save gabrielgilini/b493fd706673cd7ffaee to your computer and use it in GitHub Desktop.
Save gabrielgilini/b493fd706673cd7ffaee to your computer and use it in GitHub Desktop.
ManagersController#index
GET /api/v1/managers.json
In:
-
Out:
{
"managers": [
{"id": 1, "first_name": "John", "last_name": "Doe"},
{"id": 2, "first_name": "Jane", "last_name": "Doe"}
],
"meta": {"next_page": null}
}
ManagersController#create
POST /api/v1/managers.json
In:
{
"user_id": null,
"first_name": "John",
"last_name": "Doe"
}
* If user_id is not set, creates a Doctor with given name
Out:
{
"managers": {
"id": 1,
"first_name": "John",
"last_name": "Doe"
}
}
ManagersController#destroy
DELETE /api/v1/managers/{id}.json
In:
-
Out:
{
"managers": {
"id": 1,
"first_name": "John",
"last_name": "Doe"
}
}
AppointmentsController#index
GET /api/v1/appointments.json
In:
[optional] starts_at=yyyy-mm-dd[,yyyy-mm-dd] (accepts date range or single date)
[optional] patient_name="John"
[optional] manager_id=1
Out:
{
"appointments": [
{
"id": 1,
"user_id": 42,
"manager_id": null,
"medical_record_number": "0000003347",
"address": "Some address",
"phone": "5555555555",
"starts_at": "2014-10-15T12:00:00",
"attended": false,
"state": "active",
"type": "voice",
"duration": 120,
"template_id": null,
"rsvp": "No Answer",
"reminders": [
{
"id": 1
"length": 0,
"state": "completed",
"immediate": true,
"rsvp": true,
"content_text": {
"English": "Content in english",
"Spanish": "Content in spanish"
},
"send_date": nil
},
{
"id": 2,
"length": 1,
"state": "active",
"immediate": false,
"rsvp": false,
"content_text": {
"English": "Content in english",
"Spanish": "Content in spanish"
},
"send_date": "2015-08-12T09:00:00+04:00"
}
]
},
{
"id": 2,
"user_id": 84,
"manager_id": null,
"medical_record_number": "0000003347",
"starts_at": "2014-10-17T10:00:00",
"attended": false,
"state": "active",
"type": "sms",
"duration": 60,
"template_id": 2,
"rsvp": "Going"
}
],
"meta": {"next_page": null}
}
AppointmentTemplatesController#index
GET /api/v1/appointments/templates.json
In:
-
Out:
{
"appointment_templates": [
{
"id": 1,
"title": "My Appointment Template",
"duration": 60,
"reminders": [
{
"id": 1,
"length": 1,
"state": "active",
"immediate": false,
"rsvp": true,
"content_text": {
"English": "Content in english",
"Spanish": "Content in spanish"
},
"send_date": "2015-08-12T09:00:00+04:00"
}
]
}
]
}
attendance
attendance: true
create_advanced
appointment: {
medical_record_number: 1,
manager_id: 1,
starts_at: "2040-03-12T08:31:00-07:00",
duration: 120,
type: "sms",
template_id: 2
}
create_basic
appointment: {
medical_record_number: 1,
starts_at: "2040-03-12T08:31:00-07:00",
duration: 120,
address: "Address",
phone: "1112345555",
type: "sms",
advanced: false,
reminders_attributes: [{length: 1, send_at: "09:00 am"}]
}
reschedule
appointment: {
starts_at: "2040-03-12T08:31:00-07:00",
duration: 120,
reminders_attributes: [{id: 1, length: 1, send_at: "09:00 am"}]
}
rsvp
rsvp: "Not Going"
update_advanced
appointment: {
medical_record_number: 1,
manager_id: 1,
starts_at: "2040-03-12T08:31:00-07:00",
duration: 120,
type: "voice",
template_id: 2
}
update_basic
appointment: {
medical_record_number: 1,
manager_id: 1,
starts_at: xx,
duration: 120,
address: "Address",
phone: "1112345555",
type: "voice",
reminders_attributes: [{id: 1, length: 1, send_at: "09:00 am"}, {id: 2, _destroy: true}]
}
//se o reminder não tiver id, adiciona aos reminders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment