# Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

A simple web service used by Buffet to test interactions with a
device server. Implements basic functionality for registration, device commands
and state changes.

To start the test server yourself, run server.py. Otherwise, server.py exposes
start_server/stop_server methods.

To test locally:
./server.py

# Register a device.
curl -X POST -d "" http://localhost:8080/registrationTickets
curl -X PATCH  -d '{"userEmail": "me"}' -H "Authorization: Bearer 1/TEST-ME" \
    http://localhost:8080/registrationTickets/<id>
curl -X POST -d "" \
    http://localhost:8080/registrationTickets/<id>/finalize

# List devices
curl -X GET -d "" http://localhost:8080/devices

# Send your device a command.
curl -X POST -d '{"base": { "Reboot": {}}' http://localhost:8080/devices\
  ?deviceId=<device_id>

# Update the status of your command
curl -X PATCH -d '{"state": "done"}' http://localhost:8080/devices/\
    <command_id>

# You can also use the client library avaiable @ client_lib.
# Check out client_lib_test to see how you can use the API.