Skip to content

Commit

Permalink
Closes #51.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdobry committed May 16, 2014
1 parent 1a32e0e commit 5ff48a6
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- #30, #48 - DSCacheFactory integration
- #49 - DS.bindOne($scope, prop, resourceName, id)
- #50 - DS.bindAll($scope, prop, resourceName, query)
- #51 - Allow baseUrl to be overridable at the method level
- #52 - DS.update(resourceName, id, attrs[, options]) (different from DS.save())
- #54 - Adding functionality to resources
- #56 - DS.updateAll(resourceName, attrs, params[, options])
Expand Down
8 changes: 8 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,14 @@ module.exports = function (grunt) {
'bower_components/angular-cache/dist/angular-cache.js'
],
docs: ['guide/api']
},
{
id: 'angular-data-mocks',
title: 'angular-data-mocks',
scripts: [
'bower_components/angular-data-mocks/dist/angular-data-mocks.js'
],
docs: ['guide/api']
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"devDependencies": {
"angular": "~1.2.16",
"angular-mocks": "~1.2.16",
"angular-data-mocks": "0.1.0",
"angular-data-mocks": "0.2.0",
"angular-cache": "~3.0.0-beta.4",
"observe-js": "~0.2.0"
}
Expand Down
18 changes: 9 additions & 9 deletions dist/angular-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ function DSHttpAdapterProvider() {
function find(resourceConfig, id, options) {
options = options || {};
return this.GET(
DSUtils.makePath(resourceConfig.baseUrl, resourceConfig.endpoint, id),
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint, id),
options
);
}
Expand All @@ -1602,23 +1602,23 @@ function DSHttpAdapterProvider() {
}
DSUtils.deepMixIn(options, params);
return this.GET(
DSUtils.makePath(resourceConfig.baseUrl, resourceConfig.endpoint),
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint),
options
);
}

function create(resourceConfig, attrs, options) {
options = options || {};
return this.POST(
DSUtils.makePath(resourceConfig.baseUrl, resourceConfig.endpoint),
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint),
defaults.serialize(attrs),
options
);
}

function update(resourceConfig, id, attrs, options) {
return this.PUT(
DSUtils.makePath(resourceConfig.baseUrl, resourceConfig.endpoint, id),
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint, id),
defaults.serialize(attrs),
options
);
Expand All @@ -1632,7 +1632,7 @@ function DSHttpAdapterProvider() {
}
DSUtils.deepMixIn(options, params);
return this.PUT(
DSUtils.makePath(resourceConfig.baseUrl, resourceConfig.endpoint),
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint),
defaults.serialize(attrs),
options
);
Expand All @@ -1641,7 +1641,7 @@ function DSHttpAdapterProvider() {
function destroy(resourceConfig, id, options) {
options = options || {};
return this.DEL(
DSUtils.makePath(resourceConfig.baseUrl, resourceConfig.endpoint, id),
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint, id),
options
);
}
Expand All @@ -1654,7 +1654,7 @@ function DSHttpAdapterProvider() {
}
DSUtils.deepMixIn(options, params);
return this.DEL(
DSUtils.makePath(resourceConfig.baseUrl, resourceConfig.endpoint),
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint),
options
);
}
Expand All @@ -1664,7 +1664,7 @@ function DSHttpAdapterProvider() {
module.exports = DSHttpAdapterProvider;

},{}],32:[function(require,module,exports){
var errorPrefix = 'DS.create(resourceName, attrs): ';
var errorPrefix = 'DS.create(resourceName, attrs[, options]): ';

/**
* @doc method
Expand All @@ -1675,7 +1675,7 @@ var errorPrefix = 'DS.create(resourceName, attrs): ';
*
* ## Signature:
* ```js
* DS.create(resourceName, attrs)
* DS.create(resourceName, attrs[, options])
* ```
*
* ## Example:
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-data.min.js

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions src/adapters/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ function DSHttpAdapterProvider() {
function find(resourceConfig, id, options) {
options = options || {};
return this.GET(
DSUtils.makePath(resourceConfig.baseUrl, resourceConfig.endpoint, id),
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint, id),
options
);
}
Expand All @@ -399,23 +399,23 @@ function DSHttpAdapterProvider() {
}
DSUtils.deepMixIn(options, params);
return this.GET(
DSUtils.makePath(resourceConfig.baseUrl, resourceConfig.endpoint),
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint),
options
);
}

function create(resourceConfig, attrs, options) {
options = options || {};
return this.POST(
DSUtils.makePath(resourceConfig.baseUrl, resourceConfig.endpoint),
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint),
defaults.serialize(attrs),
options
);
}

function update(resourceConfig, id, attrs, options) {
return this.PUT(
DSUtils.makePath(resourceConfig.baseUrl, resourceConfig.endpoint, id),
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint, id),
defaults.serialize(attrs),
options
);
Expand All @@ -429,7 +429,7 @@ function DSHttpAdapterProvider() {
}
DSUtils.deepMixIn(options, params);
return this.PUT(
DSUtils.makePath(resourceConfig.baseUrl, resourceConfig.endpoint),
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint),
defaults.serialize(attrs),
options
);
Expand All @@ -438,7 +438,7 @@ function DSHttpAdapterProvider() {
function destroy(resourceConfig, id, options) {
options = options || {};
return this.DEL(
DSUtils.makePath(resourceConfig.baseUrl, resourceConfig.endpoint, id),
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint, id),
options
);
}
Expand All @@ -451,7 +451,7 @@ function DSHttpAdapterProvider() {
}
DSUtils.deepMixIn(options, params);
return this.DEL(
DSUtils.makePath(resourceConfig.baseUrl, resourceConfig.endpoint),
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint),
options
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/datastore/async_methods/create.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var errorPrefix = 'DS.create(resourceName, attrs): ';
var errorPrefix = 'DS.create(resourceName, attrs[, options]): ';

/**
* @doc method
Expand All @@ -9,7 +9,7 @@ var errorPrefix = 'DS.create(resourceName, attrs): ';
*
* ## Signature:
* ```js
* DS.create(resourceName, attrs)
* DS.create(resourceName, attrs[, options])
* ```
*
* ## Example:
Expand Down
4 changes: 2 additions & 2 deletions test/integration/datastore/async_methods/create.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe('DS.create(resourceName, attrs)', function () {
var errorPrefix = 'DS.create(resourceName, attrs): ';
describe('DS.create(resourceName, attrs[, options])', function () {
var errorPrefix = 'DS.create(resourceName, attrs[, options]): ';

it('should throw an error when method pre-conditions are not met', function (done) {
DS.create('does not exist', 5).then(function () {
Expand Down

0 comments on commit 5ff48a6

Please sign in to comment.