parsejs-rails 1.2.1.0 → 1.2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MDg1OGY3YTM5ZDZhOWUzMTFjMDg2NTY2MTViMzI1MDAzZTE5Yjc2Nw==
5
+ data.tar.gz: !binary |-
6
+ YmNhYThmYTY5MWM2MjFiNjc5YzU2NWNjNDhiYTAyOWEyN2FiZDk1YQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZjlmZGMyZjE3M2UxMTBjNDY2ZTE2NmIyNzY5ZmUzZGQyZGM5N2VlYzdhNTU3
10
+ ZTcxZWUwZGYwNTA1ZmFkMDdmOGFkZWI2NjI1NDFkNWY3YjMwMTU3Y2FiNzRh
11
+ NDgxMjVmZDYyZTdlMDNiMTVjYTg3YmJmN2Y0M2M3YTEwOTZlZWU=
12
+ data.tar.gz: !binary |-
13
+ YjJlMTg4NTA4M2FjMmY3OWU4YjY5ZTM3M2YyNjZkMDU4YzM2MWZkYTRjZjRj
14
+ NGY1MjliZmE1YzEwNTRiNjUxYTc1ZDFiYjZiY2Y0NGJmMjdiMzY4ZjMzZWYz
15
+ ZmQ1MzYyYjA5ZDk5YzJiZmRlMDlhM2M1YTM1OTk2MmQ1OGE3Mjk=
data/README.md CHANGED
@@ -4,7 +4,7 @@ The Parse Javascript SDK as an asset for Rails 3.
4
4
 
5
5
  This gem provides:
6
6
 
7
- - Parse Javascript SDK 1.2.0
7
+ - Parse Javascript SDK 1.2.2
8
8
 
9
9
  ## Installation
10
10
 
@@ -1,5 +1,5 @@
1
1
  module Parsejs
2
2
  module Rails
3
- VERSION = "1.2.1.0"
3
+ VERSION = "1.2.2.0"
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Parse JavaScript SDK
3
- * Version: 1.2.1
4
- * Built: Mon Feb 11 2013 18:54:22
3
+ * Version: 1.2.2
4
+ * Built: Tue Mar 05 2013 13:27:37
5
5
  * http://parse.com
6
6
  *
7
7
  * Copyright 2013 Parse, Inc.
@@ -13,7 +13,7 @@
13
13
  */
14
14
  (function(root) {
15
15
  root.Parse = root.Parse || {};
16
- root.Parse.VERSION = "js1.2.1";
16
+ root.Parse.VERSION = "js1.2.2";
17
17
  }(this));
18
18
 
19
19
 
@@ -1535,6 +1535,46 @@
1535
1535
  }
1536
1536
  };
1537
1537
 
1538
+ /**
1539
+ * Does a deep traversal of every item in object, calling func on all
1540
+ * instances of Parse.Object.
1541
+ * @param {Object} object The object or array to traverse deeply.
1542
+ * @param {Function} func The function to call for every Parse.Object. It will
1543
+ * be passed the Parse Object. If it returns a truthy value, that value
1544
+ * will replace the object in its parent container.
1545
+ * @returns {} Undefined, unless object is a Parse.Object, in which case it
1546
+ * returns the result of calling func on that object.
1547
+ */
1548
+ Parse._traverse = function(object, func) {
1549
+ if (object instanceof Parse.Object) {
1550
+ Parse._traverse(object.attributes, func);
1551
+ return func(object);
1552
+ }
1553
+ if (object instanceof Parse.Relation) {
1554
+ // Nothing needs to be done, but we don't want to recurse into the
1555
+ // relation's parent infinitely, so we catch this case.
1556
+ return;
1557
+ }
1558
+ if (Parse._.isArray(object)) {
1559
+ Parse._.each(object, function(child, index) {
1560
+ var newChild = Parse._traverse(child, func);
1561
+ if (newChild) {
1562
+ object[index] = newChild;
1563
+ }
1564
+ });
1565
+ return;
1566
+ }
1567
+ if (Parse._.isObject(object)) {
1568
+ Parse._each(object, function(child, key) {
1569
+ var newChild = Parse._traverse(child, func);
1570
+ if (newChild) {
1571
+ object[key] = newChild;
1572
+ }
1573
+ });
1574
+ return;
1575
+ }
1576
+ };
1577
+
1538
1578
  /**
1539
1579
  * This is like _.each, except:
1540
1580
  * * it doesn't work for so-called array-like objects,
@@ -1584,8 +1624,8 @@
1584
1624
 
1585
1625
  /**
1586
1626
  * Error code indicating that something has gone wrong with the server.
1587
- * If you get this error code, it is Parse's fault. Email feedback@parse.com
1588
- * to criticize us.
1627
+ * If you get this error code, it is Parse's fault. Contact us at
1628
+ * https://parse.com/help
1589
1629
  * @constant
1590
1630
  */
1591
1631
  INTERNAL_SERVER_ERROR: 1,
@@ -3749,6 +3789,17 @@
3749
3789
  * sent directly from the server.
3750
3790
  */
3751
3791
  _finishSave: function(serverData) {
3792
+ // Grab a copy of any object referenced by this object. These instances
3793
+ // may have already been fetched, and we don't want to lose their data.
3794
+ // Note that doing it like this means we will unify separate copies of the
3795
+ // same object, but that's a risk we have to take.
3796
+ var fetchedObjects = {};
3797
+ Parse._traverse(this.attributes, function(object) {
3798
+ if (object.id && object._hasData) {
3799
+ fetchedObjects[object.id] = object;
3800
+ }
3801
+ });
3802
+
3752
3803
  var savedChanges = _.first(this._opSetQueue);
3753
3804
  this._opSetQueue = _.rest(this._opSetQueue);
3754
3805
  this._applyOpSet(savedChanges, this._serverData);
@@ -3756,6 +3807,17 @@
3756
3807
  var self = this;
3757
3808
  Parse._each(serverData, function(value, key) {
3758
3809
  self._serverData[key] = Parse._decode(key, value);
3810
+
3811
+ // Look for any objects that might have become unfetched and fix them
3812
+ // by replacing their values with the previously observed values.
3813
+ var fetched = Parse._traverse(self._serverData[key], function(object) {
3814
+ if (fetchedObjects[object.id]) {
3815
+ return fetchedObjects[object.id];
3816
+ }
3817
+ });
3818
+ if (fetched) {
3819
+ self._serverData[key] = fetched;
3820
+ }
3759
3821
  });
3760
3822
  this._rebuildAllEstimatedData();
3761
3823
  this._saving = this._saving - 1;
@@ -4698,26 +4760,12 @@
4698
4760
 
4699
4761
  Parse.Object._findUnsavedChildren = function(object) {
4700
4762
  var results = [];
4701
- if (object instanceof Parse.Object) {
4763
+ Parse._traverse(object, function(object) {
4702
4764
  object._refreshCache();
4703
4765
  if (object.dirty()) {
4704
- results = [object];
4766
+ results.push(object);
4705
4767
  }
4706
- results.push.apply(results,
4707
- Parse.Object._findUnsavedChildren(object.attributes));
4708
- } else if (object instanceof Parse.Relation) {
4709
- // Nothing needs to be done, but we don't want to recurse into the
4710
- // relation's parent infinitely, so we catch this case.
4711
- var unused = null;
4712
- } else if (_.isArray(object)) {
4713
- _.each(object, function(child) {
4714
- results.push.apply(results, Parse.Object._findUnsavedChildren(child));
4715
- });
4716
- } else if (_.isObject(object)) {
4717
- Parse._each(object, function(child) {
4718
- results.push.apply(results, Parse.Object._findUnsavedChildren(child));
4719
- });
4720
- }
4768
+ });
4721
4769
  return results;
4722
4770
  };
4723
4771
 
@@ -6487,7 +6535,8 @@
6487
6535
  },
6488
6536
 
6489
6537
  /**
6490
- * Sets the limit of the number of results to return.
6538
+ * Sets the limit of the number of results to return. The default limit is
6539
+ * 100, with a maximum of 1000 results being returned at a time.
6491
6540
  * @param {Number} n the number of results to limit to.
6492
6541
  * @return {Parse.Query} Returns the query, so you can chain this call.
6493
6542
  */
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parsejs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1.0
5
- prerelease:
4
+ version: 1.2.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nik Macintosh
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-15 00:00:00.000000000 Z
11
+ date: 2013-03-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: railties
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -42,32 +39,25 @@ files:
42
39
  - README.md
43
40
  homepage: https://github.com/knickmack/parsejs-rails
44
41
  licenses: []
42
+ metadata: {}
45
43
  post_install_message:
46
44
  rdoc_options: []
47
45
  require_paths:
48
46
  - lib
49
47
  required_ruby_version: !ruby/object:Gem::Requirement
50
- none: false
51
48
  requirements:
52
49
  - - ! '>='
53
50
  - !ruby/object:Gem::Version
54
51
  version: '0'
55
- segments:
56
- - 0
57
- hash: -832789119919337928
58
52
  required_rubygems_version: !ruby/object:Gem::Requirement
59
- none: false
60
53
  requirements:
61
54
  - - ! '>='
62
55
  - !ruby/object:Gem::Version
63
56
  version: '0'
64
- segments:
65
- - 0
66
- hash: -832789119919337928
67
57
  requirements: []
68
58
  rubyforge_project:
69
- rubygems_version: 1.8.25
59
+ rubygems_version: 2.0.0
70
60
  signing_key:
71
- specification_version: 3
61
+ specification_version: 4
72
62
  summary: Use the Parse Javascript SDK with Rails 3
73
63
  test_files: []