Skip to content

Commit 4ac81b7

Browse files
committed
Merge pull request #6 from vhx/1.1.2
1.1.2
2 parents b8bbf9c + 208b2fd commit 4ac81b7

File tree

5 files changed

+25
-8
lines changed

5 files changed

+25
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### 1.1.2
2+
**2016-01-07**
3+
4+
* Fix bug with collection items request
5+
* Allow for both id as stand alone param, and id as part of options object
6+
17
### 1.1.1
28
**2015-12-22**
39

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (C) 2015 VHX, Inc. (https://vhx.com)
1+
Copyright (C) 2016 VHX, Inc. (https://vhx.com)
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.1
1+
1.1.2

lib/resource.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,23 @@ Resource.prototype = {
2020
client_method: method
2121
};
2222

23-
if (method.match(/retrieve|update|files/)) {
23+
if (method.match(/retrieve|update|items|files/)) {
2424
_this[method] = function(id, options, callback) {
25-
params.id = id;
26-
params.options = options;
27-
params.callback = callback;
25+
if (id.id && _this.isCallbackFunction(options)) {
26+
params.callback = options;
27+
params.id = id.id;
28+
delete options.id;
29+
params.options = id;
30+
}
31+
else {
32+
params.id = id;
33+
if (_this._this.isCallbackFunction(options)) {
34+
params.callback = options;
35+
} else {
36+
params.options = options;
37+
params.callback = callback;
38+
}
39+
}
2840

2941
_this.makeRequest(params);
3042
};
@@ -133,7 +145,6 @@ Resource.prototype = {
133145

134146
isCallbackFunction: function(obj) {
135147
return !!(obj && obj.constructor && obj.call && obj.apply);
136-
137148
}
138149
};
139150

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vhx",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "VHX Node.js API Client",
55
"keywords": [
66
"vhx",

0 commit comments

Comments
 (0)