angularjs-rails-resource 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3bf9757cba16ef593b4a0b823c29d61f47910d5
4
- data.tar.gz: 62a2d930c231b2e6a54dbeb718dca18eb4c2ff9c
3
+ metadata.gz: ffcc9f24edaba1e6f51fd95d55235aae132d54ce
4
+ data.tar.gz: 0b3d95218f41ebfb20b4860eec873b4ca5602e3b
5
5
  SHA512:
6
- metadata.gz: 610c9c4762c53128e74996a87d27c83d59ce9a186d093f614092673d084c9cf441e5cb6107a08e8599b5ae384f900e577c8c9c3ee9d39b714f75f6d2524e055e
7
- data.tar.gz: 59ca8304a0d22e07a7fc00bbf1552fdb28d6da859207dc74276762838441b1f43ef97cc3e3e53777dc2d842d7b22652c673d685e615325527241dcdbd05b1914
6
+ metadata.gz: 799f7bb936e2e5fa644dba6135c8c00fb03cc0667049ac96656684936c73d67d4091577ed6e90b4cd925e5c0ce89fcf3fe310a9410db60f106630415f1829281
7
+ data.tar.gz: d3f4da1c9998d1e61a7d1e87dd0c31b808e69e2535c8d1df048aa678603492bf3b15292bebbbb824ac0449109589897f3e3aa48b1ca4277f9da30373f569caa8
@@ -1,3 +1,9 @@
1
+ <a name="1.0.1"></a>
2
+ # 1.0.1
3
+ ## Bug Fixes
4
+ - <code>response.originalData</code> was not being saved off before the root unwrapping so it didn't match the original response data as intended. @Ditchou
5
+
6
+
1
7
  <a name="1.0.0"></a>
2
8
  # 1.0.0
3
9
  ## Deprecations
data/README.md CHANGED
@@ -35,7 +35,7 @@ angular.module('app').config(["railsSerializerProvider", function(railsSerialize
35
35
  ### Rails Asset Pipeline
36
36
  Add this line to your application's Gemfile to use the latest stable version:
37
37
  ```ruby
38
- gem 'angularjs-rails-resource', '~> 0.2.3'
38
+ gem 'angularjs-rails-resource', '~> 1.0.0'
39
39
  ```
40
40
 
41
41
  Include the javascript somewhere in your asset pipeline:
data/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angularjs-rails-resource",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "main": "angularjs-rails-resource.js",
5
5
  "description": "A resource factory inspired by $resource from AngularJS",
6
6
  "repository": {
@@ -1,7 +1,7 @@
1
1
  module Angularjs
2
2
  module Rails
3
3
  module Resource
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "angularjs-rails-resource",
3
3
  "description" : "A resource factory inspired by $resource from AngularJS",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "main" : "dist/angularjs-rails-resource.min.js",
6
6
  "homepage" : "https://github.com/FineLinePrototyping/angularjs-rails-resource.git",
7
7
  "author" : "",
@@ -79,6 +79,26 @@ describe('http setting', function () {
79
79
  $httpBackend.flush();
80
80
  }));
81
81
 
82
+
83
+ it('query should keep originalData in response if we setted the resource option : fullResponse', inject(function($httpBackend) {
84
+ var promise, result, Test;
85
+
86
+ var originalResponse = {tests: [{id: 1, name:"test_1"}, {id:2, name: "test_2"}], page: 1}
87
+
88
+ $httpBackend.expectGET('/test', headerComparison({'Accept': 'application/json'})).respond(200, originalResponse);
89
+
90
+ Test = factory(angular.extend(angular.copy(config), { fullResponse: true}));
91
+ expect(promise = Test.query()).toBeDefined();
92
+
93
+ promise.then(function (response) {
94
+ result = response;
95
+ expect(response.originalData).toEqual(originalResponse);
96
+ });
97
+
98
+ $httpBackend.flush();
99
+ }));
100
+
101
+
82
102
  it('get should pass default $http options', inject(function($httpBackend) {
83
103
  var promise, result, Test;
84
104
 
@@ -461,8 +461,6 @@
461
461
  * @returns {*} The $http response
462
462
  */
463
463
  RailsResource.deserialize = function (response) {
464
- // store off the data so we don't lose access to it after deserializing and unwrapping
465
- response.originalData = response.data;
466
464
  response.data = this.config.serializer.deserialize(response.data, this.config.resourceConstructor);
467
465
  return response;
468
466
  };
@@ -569,6 +567,12 @@
569
567
 
570
568
  promise = this.runInterceptorPhase('beforeResponse', context, promise);
571
569
 
570
+ promise = this.runInterceptorPhase('beforeResponse', context, promise).then(function (response) {
571
+ // store off the data so we don't lose access to it after deserializing and unwrapping
572
+ response.originalData = response.data;
573
+ return response;
574
+ });
575
+
572
576
  if (config.rootWrapping) {
573
577
  promise = promise.then(function (response) {
574
578
  return railsRootWrapper.unwrap(response, config.resourceConstructor);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angularjs-rails-resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy Odom
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-20 00:00:00.000000000 Z
12
+ date: 2014-01-29 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A small AngularJS add-on for integrating with Rails via JSON more easily.
15
15
  email:
@@ -19,8 +19,8 @@ executables: []
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
- - .gitignore
23
- - .travis.yml
22
+ - ".gitignore"
23
+ - ".travis.yml"
24
24
  - CHANGELOG.md
25
25
  - EXAMPLES.md
26
26
  - Gemfile
@@ -71,17 +71,17 @@ require_paths:
71
71
  - lib
72
72
  required_ruby_version: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - '>='
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  requirements: []
83
83
  rubyforge_project:
84
- rubygems_version: 2.1.9
84
+ rubygems_version: 2.2.0
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: AngularJS add-on resource add-on for integrating with Rails