Class: Api::NotificationsController

Inherits:
ApiController show all
Defined in:
app/controllers/api/notifications_controller.rb

Instance Method Summary collapse

Methods inherited from ApiController

#probe

Instance Method Details

#indexObject

Returns a list of notifications for a job

Parameters

id

Id of the job to show notifications for

Example

$ curl http://localhost:3000/api/jobs/15/notifications.json

[
  {"email_notification":{
    "created_at":"2011-05-09T12:37:11Z",
    "id":4,
    "job_id":15,
    "notified_at":"2011-05-09T12:56:32Z",
    "state":"success",
    "updated_at":"2011-05-09T12:56:32Z",
    "value":"[email protected]"}
  },
  {"url_notification":{
    "created_at":"2011-05-09T12:37:11Z",
    "id":4,
    "job_id":15,
    "notified_at":"",
    "state":"failed",
    "updated_at":"2011-05-09T12:56:32Z",
    "value":"http://host.com"}
  }
]

43
44
45
# File 'app/controllers/api/notifications_controller.rb', line 43

def index
  respond_with @job.notifications
end