Merge remote-tracking branch 'origin/master'

This commit is contained in:
James Muscat 2015-04-15 15:02:37 +01:00
commit 1d270c112f
4 changed files with 91 additions and 17 deletions

View File

@ -5,32 +5,26 @@
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"$schemaRef": { "$schemaRef": {
"id": "#$schemaRef",
"type": "string", "type": "string",
"additionalProperties": false "additionalProperties": false
}, },
"header": { "header": {
"id": "#header",
"type": "object", "type": "object",
"additionalProperties": true, "additionalProperties": true,
"properties": { "properties": {
"uploaderID": { "uploaderID": {
"id": "#uploaderID",
"type": "string", "type": "string",
"additionalProperties": false "additionalProperties": false
}, },
"softwareName": { "softwareName": {
"id": "#softwareName",
"type": "string", "type": "string",
"additionalProperties": false "additionalProperties": false
}, },
"softwareVersion": { "softwareVersion": {
"id": "#softwareVersion",
"type": "string", "type": "string",
"additionalProperties": false "additionalProperties": false
}, },
"gatewayTimestamp": { "gatewayTimestamp": {
"id": "#gatewayTimestamp",
"type": "string", "type": "string",
"format": "date-time", "format": "date-time",
"description": "Timestamp upon receipt at the gateway. If present, this property will be overwritten by the gateway; submitters are not intended to populate this property.", "description": "Timestamp upon receipt at the gateway. If present, this property will be overwritten by the gateway; submitters are not intended to populate this property.",
@ -39,33 +33,27 @@
} }
}, },
"message": { "message": {
"id": "#message",
"type": "object", "type": "object",
"additionalProperties": true, "additionalProperties": true,
"properties": { "properties": {
"systemName": { "systemName": {
"id": "#systemName",
"type": "string", "type": "string",
"additionalProperties": false "additionalProperties": false
}, },
"stationName": { "stationName": {
"id": "#stationName",
"type": "string", "type": "string",
"additionalProperties": false "additionalProperties": false
}, },
"itemName": { "itemName": {
"id": "#itemName",
"type": "string", "type": "string",
"additionalProperties": false "additionalProperties": false
}, },
"buyPrice": { "buyPrice": {
"id": "#buyPrice",
"type": "integer", "type": "integer",
"description": "Price to buy from the market", "description": "Price to buy from the market",
"additionalProperties": false "additionalProperties": false
}, },
"stationStock": { "stationStock": {
"id": "#stationStock",
"type": "integer", "type": "integer",
"additionalProperties": false "additionalProperties": false
}, },
@ -73,13 +61,11 @@
"$ref": "#/definitions/levelType" "$ref": "#/definitions/levelType"
}, },
"sellPrice": { "sellPrice": {
"id": "#sellPrice",
"type": "integer", "type": "integer",
"description": "Price to sell to the market", "description": "Price to sell to the market",
"additionalProperties": false "additionalProperties": false
}, },
"demand": { "demand": {
"id": "#demand",
"type": "integer", "type": "integer",
"additionalProperties": false "additionalProperties": false
}, },
@ -87,7 +73,6 @@
"$ref": "#/definitions/levelType" "$ref": "#/definitions/levelType"
}, },
"timestamp": { "timestamp": {
"id": "#timestamp",
"type": "string", "type": "string",
"format": "date-time", "format": "date-time",
"additionalProperties": false "additionalProperties": false

View File

@ -0,0 +1,88 @@
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"id" : "http://schemas.elite-markets.net/eddn/commodity/2#",
"type" : "object",
"additionalProperties" : false,
"required" : [ "$schemaRef", "header", "message" ],
"properties" : {
"$schemaRef" : { "type": "string" },
"header" : {
"type" : "object",
"additionalProperties" : true,
"properties" : {
"uploaderID" : { "type": "string" },
"softwareName" : { "type": "string" },
"softwareVersion" : { "type": "string" },
"gatewayTimestamp" : {
"type": "string",
"format": "date-time",
"description": "Timestamp upon receipt at the gateway. If present, this property will be overwritten by the gateway; submitters are not intended to populate this property."
}
}
},
"message": {
"type": "object",
"additionalProperties": false,
"required": [ "systemName", "stationName", "timestamp", "commodities" ],
"properties": {
"systemName": {
"type" : "string"
},
"stationName": {
"type" : "string"
},
"timestamp": {
"type" : "string",
"format" : "date-time"
},
"commodities": {
"type" : "array",
"minItems" : 1,
"items" : {
"oneOf": [
{
"type" : "object",
"additionalProperties" : false,
"required" : [ "name", "buyPrice", "supply", "sellPrice", "demand" ],
"properties" : {
"name": {
"type" : "string",
"minLength" : 1
},
"buyPrice": {
"type": "integer",
"description": "Price to buy from the market"
},
"supply": {
"type": "integer"
},
"supplyLevel": {
"$ref": "#/definitions/levelType"
},
"sellPrice": {
"type": "integer",
"description": "Price to sell to the market"
},
"demand": {
"type": "integer"
},
"demandLevel": {
"$ref": "#/definitions/levelType"
}
}
}
]
}
}
}
}
},
"definitions" : {
"levelType" : {
"enum": ["Low", "Med", "High"]
}
}
}

View File

@ -27,7 +27,7 @@ setup(
long_description="""\ long_description="""\
The Elite: Dangerous Data Network allows E:D players to share data. Not affiliated with Frontier Developments. The Elite: Dangerous Data Network allows E:D players to share data. Not affiliated with Frontier Developments.
""", """,
install_requires=["bottle", "enum34", "gevent", "jsonschema", "pyzmq", "simplejson"], install_requires=["argparse", "bottle", "enum34", "gevent", "jsonschema", "pyzmq", "simplejson"],
entry_points={ entry_points={
'console_scripts': [ 'console_scripts': [
'eddn-gateway = eddn.Gateway:main', 'eddn-gateway = eddn.Gateway:main',

View File

@ -35,7 +35,8 @@ class _Settings(object):
GATEWAY_JSON_SCHEMAS = { GATEWAY_JSON_SCHEMAS = {
"http://schemas.elite-markets.net/eddn/commodity/1": "schemas/commodity-v0.1.json", "http://schemas.elite-markets.net/eddn/commodity/1": "schemas/commodity-v0.1.json",
"http://schemas.elite-markets.net/eddn/commodity/1/test": "schemas/commodity-v0.1.json" "http://schemas.elite-markets.net/eddn/commodity/1/test": "schemas/commodity-v0.1.json",
"http://schemas.elite-markets.net/eddn/commodity/2": "schemas/commodity-v2.0-draft.json"
} }
def loadFrom(self, fileName): def loadFrom(self, fileName):