Skip to content

Commit

Permalink
Fixed the usage of Author.role property
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Jun 20, 2015
1 parent 349a6f6 commit 75cb7bb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
This file contains highlights of what changes on each version of the [Akismet.js](https://www.npmjs.com/package/akismet-js) library.

#### Version 0.6.1
- Fixed the usage of `Author.role` property.
- Fixed the usage of `Client.isTest` property.
- Fixed a unit test
- Fixed a unit test.

#### Version 0.6.0
- Added `role` property to `Author` class.
Expand Down
2 changes: 1 addition & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Blog.prototype.toJSON=function(space) {
* @return {String} The string representation of this object.
*/
Blog.prototype.toString=function() {
return this.constructor.name+' '+JSON.stringify(this, null, 2);
return this.constructor.name+' '+this.toJSON(2);
};

/**
Expand Down
23 changes: 12 additions & 11 deletions lib/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ function Author(options) {
* @type String
*/
this.name=null;

/**
* The role of the author.
* If you set it to `"administrator"`, Akismet will always return `false`.
* @property role
* @type String
* @default null
*/
this.role=null;

/**
* The URL of the author's website.
Expand All @@ -81,15 +90,6 @@ function Author(options) {
* @type String
*/
this.userAgent=null;

/**
* The role of the author.
* If you set it to `"administrator"`, Akismet will always return `false`.
* @property role
* @type String
* @default null
*/
this.role=null;

// Initialize the instance.
if(typeof options=='object' && options) {
Expand Down Expand Up @@ -138,6 +138,7 @@ Author.prototype.toJSON=function(space) {
if(typeof this.url=='string') map.comment_author_url=this.url;
if(typeof this.userAgent=='string') map.user_agent=this.userAgent;
if(typeof this.ipAddress=='string') map.user_ip=this.ipAddress;
if(typeof this.role=='string') map.user_role=this.role;
return JSON.stringify(map, null, space);
};

Expand All @@ -147,7 +148,7 @@ Author.prototype.toJSON=function(space) {
* @return {String} The string representation of this object.
*/
Author.prototype.toString=function() {
return this.constructor.name+' '+JSON.stringify(this, null, 2);
return this.constructor.name+' '+this.toJSON(2);
};

/**
Expand Down Expand Up @@ -281,7 +282,7 @@ Comment.prototype.toJSON=function(space) {
* @return {String} The string representation of this object.
*/
Comment.prototype.toString=function() {
return this.constructor.name+' '+JSON.stringify(this, null, 2);
return this.constructor.name+' '+this.toJSON(2);
};

// Public interface.
Expand Down

0 comments on commit 75cb7bb

Please sign in to comment.