#%RAML 0.8
title: OCFHumidity
version: v1.1.0-20160519
traits:
 - interface :
     queryParameters:
       if:
         enum: ["oic.if.a", "oic.if.s", "oic.if.baseline"]

/HumidityResURI:
  description: |
    This resource describes a sensed or desired humidity.
    The value humidity is an integer describing the percentage measured relative humidity.
    The value desiredHumidity is an integer showing the desired target relative humidity.

  displayName: Humidity
  
  is : ['interface']
  get:
    description: |
      Retrieves the current (relative) humidity level.

    responses :
      200:
        body:
          application/json:
            schema: |
              {
                "id": "http://openinterconnect.org/iotdatamodels/schemas/oic.r.humidity.json#",
                "$schema": "http://json-schema.org/draft-04/schema#",
                "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.",
                "title": "Humidity",
                "definitions": {
                  "oic.r.humidity": {
                    "type": "object",
                    "properties": {
                      "humidity":    {
                        "type": "integer",
                        "description": "ReadOnly, Current sensed value for Humidity"
                      },
                      "desiredHumidity":  {
                        "type": "integer",
                        "description": "Desired value for Humidity"
                      }
                    }
                  }
                },
                "type": "object",
                "allOf": [
                  {"$ref": "oic.core.json#/definitions/oic.core"},
                  {"$ref": "oic.baseResource.json#/definitions/oic.r.baseresource"},
                  {"$ref": "#/definitions/oic.r.humidity"}
                ],
                "required": ["humidity"]
              }

            example: |
              {
                "rt":               ["oic.r.humidity"],
                "id":               "unique_example_id",
                "humidity":         40,
                "desiredHumidity":  40
              }

  post:
    description: |
      Sets the desired relative humidity level.

    body:
      application/json:
        schema: |
          {
            "id": "http://openinterconnect.org/iotdatamodels/schemas/oic.r.humidity-Update.json#",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.",
            "title": "Humidity",
            "definitions": {
              "oic.r.humidity": {
                "type": "object",
                "properties": {
                  "desiredHumidity":  {
                    "type": "integer",
                    "description": "Desired value for Humidity"
                  }
                }
              }
            },
            "type": "object",
            "allOf": [
              {"$ref": "oic.core.json#/definitions/oic.core"},
              {"$ref": "oic.baseResource.json#/definitions/oic.r.baseresource"},
              {"$ref": "#/definitions/oic.r.humidity"}
            ]
          }

        example: |
          {
            "id":               "unique_example_id",
            "desiredHumidity" : 45
          }

    responses :
      200:
        description: |
          Indicates that the relative humidity level was changed.
          The new relative humidity level is provided in the response.

        body:
          application/json:
            schema: |
              {
                "id": "http://openinterconnect.org/iotdatamodels/schemas/oic.r.humidity-Update.json#",
                "$schema": "http://json-schema.org/draft-04/schema#",
                "description" : "Copyright (c) 2016 Open Connectivity Foundation, Inc. All rights reserved.",
                "title": "Humidity",
                "definitions": {
                  "oic.r.humidity": {
                    "type": "object",
                    "properties": {
                      "desiredHumidity":  {
                        "type": "integer",
                        "description": "Desired value for Humidity"
                      }
                    }
                  }
                },
                "type": "object",
                "allOf": [
                  {"$ref": "oic.core.json#/definitions/oic.core"},
                  {"$ref": "oic.baseResource.json#/definitions/oic.r.baseresource"},
                  {"$ref": "#/definitions/oic.r.humidity"}
                ]
              }

            example: |
              {
                "id":              "unique_example_id",
                "desiredHumidity": 45
              }
