Camel case
Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
parent
9f9f758d18
commit
6daeaa971f
|
@ -1,6 +1,6 @@
|
|||
var uuid = require("uuid/v4");
|
||||
|
||||
function Spec_0_1(_caller){
|
||||
function Spec01(_caller){
|
||||
this.payload = {
|
||||
cloudEventsVersion: "0.1",
|
||||
eventID: uuid()
|
||||
|
@ -24,7 +24,7 @@ function Spec_0_1(_caller){
|
|||
*
|
||||
* throw an error if do not pass.
|
||||
*/
|
||||
Spec_0_1.prototype.check = function() {
|
||||
Spec01.prototype.check = function() {
|
||||
|
||||
if(!this.payload["eventType"]){
|
||||
throw {message: "'eventType' is invalid"};
|
||||
|
@ -32,47 +32,47 @@ Spec_0_1.prototype.check = function() {
|
|||
|
||||
};
|
||||
|
||||
Spec_0_1.prototype.type = function(_type){
|
||||
Spec01.prototype.type = function(_type){
|
||||
this.payload["eventType"] = _type;
|
||||
return this;
|
||||
};
|
||||
|
||||
Spec_0_1.prototype.eventTypeVersion = function(version){
|
||||
Spec01.prototype.eventTypeVersion = function(version){
|
||||
this.payload["eventTypeVersion"] = version;
|
||||
return this;
|
||||
};
|
||||
|
||||
Spec_0_1.prototype.source = function(_source){
|
||||
Spec01.prototype.source = function(_source){
|
||||
this.payload["source"] = _source;
|
||||
return this;
|
||||
};
|
||||
|
||||
Spec_0_1.prototype.id = function(_id){
|
||||
Spec01.prototype.id = function(_id){
|
||||
this.payload["eventID"] = _id;
|
||||
return this;
|
||||
};
|
||||
|
||||
Spec_0_1.prototype.time = function(_time){
|
||||
Spec01.prototype.time = function(_time){
|
||||
this.payload["eventTime"] = _time.toISOString();
|
||||
return this;
|
||||
};
|
||||
|
||||
Spec_0_1.prototype.schemaurl = function(_schemaurl){
|
||||
Spec01.prototype.schemaurl = function(_schemaurl){
|
||||
this.payload["schemaURL"] = _schemaurl;
|
||||
return this;
|
||||
};
|
||||
|
||||
Spec_0_1.prototype.contenttype = function(_contenttype){
|
||||
Spec01.prototype.contenttype = function(_contenttype){
|
||||
this.payload["contentType"] = _contenttype;
|
||||
return this;
|
||||
};
|
||||
|
||||
Spec_0_1.prototype.data = function(_data){
|
||||
Spec01.prototype.data = function(_data){
|
||||
this.payload["data"] = _data;
|
||||
return this;
|
||||
};
|
||||
|
||||
Spec_0_1.prototype.addExtension = function(key, value){
|
||||
Spec01.prototype.addExtension = function(key, value){
|
||||
if(!this.payload["extensions"]){
|
||||
this.payload["extensions"] = {};
|
||||
}
|
||||
|
@ -80,4 +80,4 @@ Spec_0_1.prototype.addExtension = function(key, value){
|
|||
return this;
|
||||
};
|
||||
|
||||
module.exports = Spec_0_1;
|
||||
module.exports = Spec01;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var uuid = require("uuid/v4");
|
||||
var empty = require("is-empty")
|
||||
|
||||
function Spec_0_2(){
|
||||
function Spec02(){
|
||||
this.payload = {
|
||||
specversion: "0.2",
|
||||
id: uuid()
|
||||
|
@ -11,7 +11,7 @@ function Spec_0_2(){
|
|||
/*
|
||||
* Check the spec constraints.
|
||||
*/
|
||||
Spec_0_2.prototype.check = function(){
|
||||
Spec02.prototype.check = function(){
|
||||
|
||||
if(empty(this.payload["type"])) {
|
||||
throw {message: "'type' is invalid"};
|
||||
|
@ -31,44 +31,44 @@ Spec_0_2.prototype.check = function(){
|
|||
}
|
||||
}
|
||||
|
||||
Spec_0_2.prototype.type = function(_type){
|
||||
Spec02.prototype.type = function(_type){
|
||||
this.payload["type"] = _type;
|
||||
return this;
|
||||
}
|
||||
|
||||
Spec_0_2.prototype.source = function(_source){
|
||||
Spec02.prototype.source = function(_source){
|
||||
this.payload["source"] = _source;
|
||||
return this;
|
||||
}
|
||||
|
||||
Spec_0_2.prototype.id = function(_id){
|
||||
Spec02.prototype.id = function(_id){
|
||||
this.payload["id"] = _id;
|
||||
return this;
|
||||
}
|
||||
|
||||
Spec_0_2.prototype.time = function(_time){
|
||||
Spec02.prototype.time = function(_time){
|
||||
this.payload["time"] = _time.toISOString();
|
||||
return this;
|
||||
}
|
||||
|
||||
Spec_0_2.prototype.schemaurl = function(_schemaurl){
|
||||
Spec02.prototype.schemaurl = function(_schemaurl){
|
||||
this.payload["schemaurl"] = _schemaurl;
|
||||
return this;
|
||||
}
|
||||
|
||||
Spec_0_2.prototype.contenttype = function(_contenttype){
|
||||
Spec02.prototype.contenttype = function(_contenttype){
|
||||
this.payload["contenttype"] = _contenttype;
|
||||
return this;
|
||||
}
|
||||
|
||||
Spec_0_2.prototype.data = function(_data){
|
||||
Spec02.prototype.data = function(_data){
|
||||
this.payload["data"] = _data;
|
||||
return this;
|
||||
}
|
||||
|
||||
Spec_0_2.prototype.addExtension = function(key, value){
|
||||
Spec02.prototype.addExtension = function(key, value){
|
||||
this.payload[key] = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
module.exports = Spec_0_2;
|
||||
module.exports = Spec02;
|
||||
|
|
Loading…
Reference in New Issue