active-model-adapter-source 1.13.5 → 1.13.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGNmZDExNzg0MDlmMjViOGNmOTQ0NWExNDU4ZDIzMjEyZjE4NmQ4ZA==
4
+ ZDk4ZDg4NmUzMmE0MzRkZWIxZGU5NWIzN2YyNjZiMzZmMTU0NGEwNw==
5
5
  data.tar.gz: !binary |-
6
- OWY3ZWM2ZmQzOTZjY2ZjZjEwMGMzYjc3Y2ViMDhiNjJkY2VlY2VhMA==
6
+ ZWVhNmQ0ZDM3ZDFiZTkwODVkZDFjNjM2ZDEwZDhlMWU4ZTljMWNjYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDZjNWM4ZDY3MjliY2MzNmVhYjgzN2JjY2E3MjllZDkxOTIzYWZlY2UzMGQz
10
- YzE2MjljZDhhMzRjODA1MGQxNDJkY2QwMWM3ZjM5YmYyYzExZDI0MmRlZmRh
11
- NmZmZTU4NmI2NzlhYjdlOWM4MmNiYzYyYjMxZWFhYWJlYzc3NTU=
9
+ ODM3YTNlZDA0YzgzNGFjNzIwNThmMTIwNzRlZjhiMTA2YWYxZWZmNmM2ZmIz
10
+ NWYxYjg3MDY0NWY5YjhlOGU3YmU5MmRlOTk1YTYzNzQ0MWI0N2E0MDUyOTI3
11
+ ZDM3MWExZjQ5YTc0YWU5N2VlNjNmOGQ4MGYyNGRkNmVmM2YwODg=
12
12
  data.tar.gz: !binary |-
13
- YTAwZTk5NDAxMjQ5NDVjNTgzYmQzN2VhMzM3MGZkOGYzMTdiNDVhMjZhNjI2
14
- ZGE4ZjZlN2Y1YjZiMTc5MzkzMTJhNWY5ZWUxNDgxMDE2YzAxOTY3YjA5NDBl
15
- ZGVkYTliZmVhYzgxM2YxNzEyMTI3Nzk4YmY4MWJiMjUwMTU3Nzk=
13
+ OTMzZmI0YjgwYjQzMzQ2ZGFkODJiYzY5NTY0NTA2OTEzMWEzNGFiN2M2Nzgz
14
+ NWVlNDEyZDU1YjRjMGY2NDRiOGZmOGRhNzliMTc5YzdlNTc3MDYwZjE3YTMx
15
+ YmI0MGU3ZTcxZjk0NTY5ZjFkNTg2ZjhkZWU3Zjg2NGIzNDQ4MTQ=
@@ -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.5
8
+ * @version 1.13.6
9
9
  */
10
10
 
11
11
  (function() {
@@ -214,9 +214,6 @@ define('active-model-adapter', ['exports', 'ember', 'ember-data'], function (exp
214
214
  var errorsHashToArray = _emberData["default"].errorsHashToArray;
215
215
  var RESTAdapter = _emberData["default"].RESTAdapter;
216
216
  var _Ember$String = _ember["default"].String;
217
- var pluralize = _Ember$String.pluralize;
218
- var decamelize = _Ember$String.decamelize;
219
- var underscore = _Ember$String.underscore;
220
217
 
221
218
  /**
222
219
  @module ember-data
@@ -313,6 +310,9 @@ define('active-model-adapter', ['exports', 'ember', 'ember-data'], function (exp
313
310
  @extends DS.RESTAdapter
314
311
  **/
315
312
 
313
+ var pluralize = _Ember$String.pluralize;
314
+ var decamelize = _Ember$String.decamelize;
315
+ var underscore = _Ember$String.underscore;
316
316
  var ActiveModelAdapter = RESTAdapter.extend({
317
317
  defaultSerializer: '-active-model',
318
318
  /**
@@ -371,7 +371,6 @@ define('active-model-serializer', ['exports', 'ember-data', 'ember'], function (
371
371
  var camelize = _Ember$String.camelize;
372
372
  var underscore = _Ember$String.underscore;
373
373
  var RESTSerializer = _emberData["default"].RESTSerializer;
374
- var normalizeModelName = _emberData["default"].normalizeModelName;
375
374
 
376
375
  /**
377
376
  The ActiveModelSerializer is a subclass of the RESTSerializer designed to integrate
@@ -460,6 +459,7 @@ define('active-model-serializer', ['exports', 'ember-data', 'ember'], function (
460
459
  @namespace DS
461
460
  @extends DS.RESTSerializer
462
461
  */
462
+ var normalizeModelName = _emberData["default"].normalizeModelName;
463
463
  var ActiveModelSerializer = RESTSerializer.extend({
464
464
  // SERIALIZE
465
465
 
@@ -483,10 +483,10 @@ define('active-model-serializer', ['exports', 'ember-data', 'ember'], function (
483
483
  */
484
484
  keyForRelationship: function (relationshipModelName, kind) {
485
485
  var key = decamelize(relationshipModelName);
486
- if (kind === 'belongsTo') {
487
- return key + '_id';
488
- } else if (kind === 'hasMany') {
489
- return singularize(key) + '_ids';
486
+ if (kind === "belongsTo") {
487
+ return key + "_id";
488
+ } else if (kind === "hasMany") {
489
+ return singularize(key) + "_ids";
490
490
  } else {
491
491
  return key;
492
492
  }
@@ -529,7 +529,7 @@ define('active-model-serializer', ['exports', 'ember-data', 'ember'], function (
529
529
  serializePolymorphicType: function (snapshot, json, relationship) {
530
530
  var key = relationship.key;
531
531
  var belongsTo = snapshot.belongsTo(key);
532
- var jsonKey = underscore(key + '_type');
532
+ var jsonKey = underscore(key + "_type");
533
533
 
534
534
  if (_ember["default"].isNone(belongsTo)) {
535
535
  json[jsonKey] = null;
@@ -622,17 +622,21 @@ define('active-model-serializer', ['exports', 'ember-data', 'ember'], function (
622
622
 
623
623
  var payloadKey, payload;
624
624
  if (relationship.options.polymorphic) {
625
- payloadKey = this.keyForAttribute(key, 'deserialize');
625
+ payloadKey = this.keyForAttribute(key, "deserialize");
626
+ if (!hash.hasOwnProperty(payloadKey)) {
627
+ return;
628
+ }
626
629
  payload = hash[payloadKey];
630
+
627
631
  if (payload && payload.type) {
628
632
  payload.type = this.modelNameFromPayloadKey(payload.type);
629
- } else if (payload && relationship.kind === 'hasMany') {
633
+ } else if (payload && relationship.kind === "hasMany") {
630
634
  payload.forEach(function (single) {
631
635
  return single.type = _this.modelNameFromPayloadKey(single.type);
632
636
  });
633
637
  }
634
638
  } else {
635
- payloadKey = this.keyForRelationship(key, relationship.kind, 'deserialize');
639
+ payloadKey = this.keyForRelationship(key, relationship.kind, "deserialize");
636
640
  if (!hash.hasOwnProperty(payloadKey)) {
637
641
  return;
638
642
  }
@@ -650,7 +654,7 @@ define('active-model-serializer', ['exports', 'ember-data', 'ember'], function (
650
654
 
651
655
  extractRelationships: function (modelClass, resourceHash) {
652
656
  modelClass.eachRelationship(function (key, relationshipMeta) {
653
- var relationshipKey = this.keyForRelationship(key, relationshipMeta.kind, 'deserialize');
657
+ var relationshipKey = this.keyForRelationship(key, relationshipMeta.kind, "deserialize");
654
658
 
655
659
  // prefer the format the AMS gem expects, e.g.:
656
660
  // relationship: {id: id, type: type}
@@ -680,32 +684,32 @@ define('active-model-serializer', ['exports', 'ember-data', 'ember'], function (
680
684
 
681
685
  function extractPolymorphicRelationships(key, relationshipMeta, resourceHash, relationshipKey) {
682
686
  var polymorphicKey = decamelize(key);
683
- if (polymorphicKey in resourceHash && typeof resourceHash[polymorphicKey] === 'object') {
687
+ var hash = resourceHash[polymorphicKey];
688
+ if (hash !== null && typeof hash === 'object') {
684
689
  if (relationshipMeta.kind === 'belongsTo') {
685
- var hash = resourceHash[polymorphicKey];
686
690
  var id = hash.id;
687
691
  var type = hash.type;
688
692
 
689
693
  resourceHash[relationshipKey] = { id: id, type: type };
690
694
  // otherwise hasMany
691
695
  } else {
692
- var hashes = resourceHash[polymorphicKey];
696
+ var hashes = resourceHash[polymorphicKey];
693
697
 
694
- if (!hashes) {
695
- return;
696
- }
698
+ if (!hashes) {
699
+ return;
700
+ }
697
701
 
698
- // TODO: replace this with map when ActiveModelAdapter branches for Ember Data 2.0
699
- var array = [];
700
- for (var i = 0, _length = hashes.length; i < _length; i++) {
701
- var hash = hashes[i];
702
- var id = hash.id;
703
- var type = hash.type;
702
+ // TODO: replace this with map when ActiveModelAdapter branches for Ember Data 2.0
703
+ var array = [];
704
+ for (var i = 0, _length = hashes.length; i < _length; i++) {
705
+ var _hash = hashes[i];
706
+ var id = _hash.id;
707
+ var type = _hash.type;
704
708
 
705
- array.push({ id: id, type: type });
709
+ array.push({ id: id, type: type });
710
+ }
711
+ resourceHash[relationshipKey] = array;
706
712
  }
707
- resourceHash[relationshipKey] = array;
708
- }
709
713
  }
710
714
  }
711
715
 
@@ -718,10 +722,10 @@ define('index', ['exports', './active-model-adapter', './active-model-serializer
718
722
  });
719
723
  define("initializers/active-model-adapter", ["exports", "active-model-adapter", "active-model-serializer"], function (exports, _activeModelAdapter, _activeModelAdapterActiveModelSerializer) {
720
724
  exports["default"] = {
721
- name: "active-model-adapter",
725
+ name: 'active-model-adapter',
722
726
  initialize: function (registry, application) {
723
- registry.register("adapter:-active-model", _activeModelAdapter["default"]);
724
- registry.register("serializer:-active-model", _activeModelAdapterActiveModelSerializer["default"].extend({ isNewSerializerAPI: true }));
727
+ registry.register('adapter:-active-model', _activeModelAdapter["default"]);
728
+ registry.register('serializer:-active-model', _activeModelAdapterActiveModelSerializer["default"].extend({ isNewSerializerAPI: true }));
725
729
  }
726
730
  };
727
731
  });
@@ -751,7 +755,7 @@ define('instance-initializers/active-model-adapter', ['exports', 'active-model-a
751
755
  }
752
756
 
753
757
  registry.register('adapter:-active-model', _activeModelAdapter["default"]);
754
- registry.register('serializer:-active-model', _activeModelAdapterActiveModelSerializer["default"]);
758
+ registry.register('serializer:-active-model', _activeModelAdapterActiveModelSerializer["default"].extend({ isNewSerializerAPI: true }));
755
759
  }
756
760
  };
757
761
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "active-model-adapter",
3
- "version": "1.13.5",
3
+ "version": "1.13.6",
4
4
  "repository": "https://github.com/ember-data/active-model-adapter",
5
5
  "description": "The default blueprint for ember-cli addons.",
6
6
  "directories": {
@@ -32,6 +32,7 @@
32
32
  "ember-cli-dependency-checker": "^1.0.0",
33
33
  "ember-cli-htmlbars": "0.7.6",
34
34
  "ember-cli-inject-live-reload": "^1.3.0",
35
+ "ember-cli-pretender": "0.4.0",
35
36
  "ember-cli-qunit": "0.3.13",
36
37
  "ember-cli-uglify": "^1.0.1",
37
38
  "ember-data": "1.0.0-beta.18",
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.5
4
+ version: 1.13.6
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-07-21 00:00:00.000000000 Z
13
+ date: 2015-08-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ember-data-source