active-model-adapter-source 1.13.0 → 1.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/dist/active-model-adapter.js +30 -13
- data/package.json +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDM5MzFhOWY0NjFkMzU3NTBiNTU3YjBhZmU0MWU3YWE2YmU2MDg0Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjY5OTAyZWQzYWZmNWRiNzAzZDAxYjc3YTg0YjY2MGVmMTk4YTM0ZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDRkMWVhZmI5YTcxMzJmNGM5OWViOTY2ZTVhODk1MmY0NmNmYTQzYzk4NDk3
|
10
|
+
NDgxODgzOGI1NTAwMmRkNzIxYTA2Mjg3Njg0MzMxMzU0ZGY2MTA3OGNlZWI4
|
11
|
+
NDhjZDhlOTgxNjFlZGMxYTNiYWU4MWZhOTMxMzI5OWE1NzczNjA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTc4MWQyNTY4YTNkMmE0NzJiNjJmMWRkNDkwZmY3MmUxMTk3NmJiNTY4MWRh
|
14
|
+
NTc2ZmM3NWFiNDFmYmI3MjRkODE4OTRkZTA4ZWQ0MjI0ZTM2MjU3NDY1NDM2
|
15
|
+
M2Q3ZjdjYTljODY5YjIzMjgzNGUzMTJmYWE5NjMyN2RhNjU0Yzg=
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
|
6
6
|
* @license Licensed under MIT license
|
7
7
|
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
|
8
|
-
* @version 1.13.
|
8
|
+
* @version 1.13.1
|
9
9
|
*/
|
10
10
|
|
11
11
|
(function() {
|
@@ -220,6 +220,7 @@ define('active-model-adapter', ['exports', 'ember', 'ember-data'], function (exp
|
|
220
220
|
var pluralize = _ember["default"].String.pluralize;
|
221
221
|
var RESTAdapter = _emberData["default"].RESTAdapter;
|
222
222
|
var InvalidError = _emberData["default"].InvalidError;
|
223
|
+
var errorsHashToArray = _emberData["default"].errorsHashToArray;
|
223
224
|
|
224
225
|
/**
|
225
226
|
The ActiveModelAdapter is a subclass of the RESTAdapter designed to integrate
|
@@ -332,30 +333,46 @@ define('active-model-adapter', ['exports', 'ember', 'ember-data'], function (exp
|
|
332
333
|
},
|
333
334
|
|
334
335
|
/**
|
335
|
-
The ActiveModelAdapter overrides the `
|
336
|
-
to
|
337
|
-
responses.
|
336
|
+
The ActiveModelAdapter overrides the `handleResponse` method
|
337
|
+
to format errors passed to a DS.InvalidError for all
|
338
|
+
422 Unprocessable Entity responses.
|
338
339
|
A 422 HTTP response from the server generally implies that the request
|
339
340
|
was well formed but the API was unable to process it because the
|
340
341
|
content was not semantically correct or meaningful per the API.
|
341
342
|
For more information on 422 HTTP Error code see 11.2 WebDAV RFC 4918
|
342
343
|
https://tools.ietf.org/html/rfc4918#section-11.2
|
343
|
-
@method
|
344
|
-
@param
|
345
|
-
@
|
344
|
+
@method handleResponse
|
345
|
+
@param {Number} status
|
346
|
+
@param {Object} headers
|
347
|
+
@param {Object} payload
|
348
|
+
@return {Object | DS.AdapterError} response
|
346
349
|
*/
|
347
|
-
|
348
|
-
|
350
|
+
handleResponse: function (status, headers, payload) {
|
351
|
+
if (this.isInvalid(status, headers, payload)) {
|
352
|
+
var errors = errorsHashToArray(payload.errors);
|
349
353
|
|
350
|
-
|
351
|
-
var response = _ember["default"].$.parseJSON(jqXHR.responseText);
|
352
|
-
return new InvalidError(response);
|
354
|
+
return new InvalidError(errors);
|
353
355
|
} else {
|
354
|
-
return
|
356
|
+
return this._super.apply(this, arguments);
|
355
357
|
}
|
356
358
|
}
|
357
359
|
});
|
358
360
|
|
361
|
+
if (!errorsHashToArray) {
|
362
|
+
ActiveModelAdapter.reopen({
|
363
|
+
ajaxError: function (jqXHR) {
|
364
|
+
var error = this._super.apply(this, arguments);
|
365
|
+
|
366
|
+
if (jqXHR && jqXHR.status === 422) {
|
367
|
+
var response = _ember["default"].$.parseJSON(jqXHR.responseText);
|
368
|
+
return new InvalidError(response);
|
369
|
+
} else {
|
370
|
+
return error;
|
371
|
+
}
|
372
|
+
}
|
373
|
+
});
|
374
|
+
}
|
375
|
+
|
359
376
|
exports["default"] = ActiveModelAdapter;
|
360
377
|
});
|
361
378
|
define('active-model-serializer', ['exports', 'ember', 'ember-data'], function (exports, _ember, _emberData) {
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-model-adapter-source
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.13.
|
4
|
+
version: 1.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Terzic
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-06-
|
13
|
+
date: 2015-06-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ember-source
|