angularjs-rails-resource 1.2.0 → 1.2.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: 168a47c7cf77844625f4f730eb0a9f3c870618d7
4
- data.tar.gz: ad71d9b538c88d7fb0c3ffb251ef94a44ebff3db
3
+ metadata.gz: 45894ff519ef50bed5feda97630ad148e15bfe3a
4
+ data.tar.gz: 9b757277985bf87c0b5d67ad8daade45965ed9a8
5
5
  SHA512:
6
- metadata.gz: b02702b23f89ddc927d956dde10aff6c5165dd0fff11da4258179384dede75429a172a3c56ed07495a8d4b24f2c60245dd37bb565500da3dda0c713ca66db4ba
7
- data.tar.gz: 9bddfe4eaf76e420b5a7696e2120086218c2938d686802297889c0edc7cebd441f5b0eda161807c7f339b5b8020acd46f292dc667faa5cec4e5c136a02c0adf3
6
+ metadata.gz: 3807f841e481d2125c3a7dbaa7202604ec2691d8c7244d127311bcf2fa8b40c498d46bd74fea8a63a5f4c42865eb22ad83f717afe2c66b4ba51a81b34e0794f4
7
+ data.tar.gz: db60cbf3f22a5552a5e60b4f7c769cfb6094e05fd646ccfb27c6a10456a0043e7b99b1a35029d64e3b4905cd6abf0ab82dc2f5ae42dbcdfdc800309404f54b30
@@ -1,6 +1,6 @@
1
1
  language: node_js
2
2
  node_js:
3
- - 0.8
3
+ - 0.10.30
4
4
 
5
5
  before_script:
6
6
  - export DISPLAY=:99.0
@@ -1,3 +1,8 @@
1
+ <a name="1.2.1"></a>
2
+ # 1.2.1
3
+ ## Bug Fixes
4
+ - Call beforeResponse interceptor only once - #139 (@shuhei)
5
+
1
6
  <a name="1.2.0"></a>
2
7
  # 1.2.0
3
8
  ## Bug Fixes
@@ -117,6 +117,7 @@ The following example exposes a <code>getAuthor</code> instance method that woul
117
117
  resource.prototype.getAuthor = function () {
118
118
  return Author.get(this.authorId);
119
119
  };
120
+ return resource;
120
121
  }]);
121
122
  angular.module('book.controllers').controller('BookShelfCtrl', ['$scope', 'Book', function ($scope, Book) {
122
123
  $scope.getAuthorDetails = function (book) {
data/README.md CHANGED
@@ -125,13 +125,14 @@ Resource.configure(config);
125
125
  ```javascript
126
126
  angular.module('book.controllers').controller('BookShelfCtrl', ['$scope', 'Book', function ($scope, Book) {
127
127
  $scope.searching = true;
128
+ $scope.books = [];
129
+
128
130
  // Find all books matching the title
129
- $scope.books = Book.query({
130
- title: title
131
- });
132
- $scope.books.then(function (results) {
131
+ Book.query({ title: title }).then(function (results) {
132
+ $scope.books = results;
133
133
  $scope.searching = false;
134
134
  }, function (error) {
135
+ // do something about the error
135
136
  $scope.searching = false;
136
137
  });
137
138
 
@@ -246,10 +247,10 @@ The URL can be specified as one of three ways:
246
247
 
247
248
  2. basic string - A string without any expression variables will be treated as a base URL and assumed that instance requests should append id to the end.
248
249
 
249
- 3. AngularJS expression - An expression url is evaluated at run time based on the given context for non-instance methods or the instance itself. For example, given the url expression: /stores/{{storeId}}/items/{{id}}
250
+ 3. AngularJS expression - An expression url is evaluated at run time based on the given context for non-instance methods or the instance itself. For example, given the url expression: `/stores/{{storeId}}/items/{{id}}`
250
251
 
251
252
  ```javascript
252
- Item.query({category: 'Software'}, {storeId: 123}) // would generate a GET to /stores/1234/items?category=Software
253
+ Item.query({category: 'Software'}, {storeId: 123}) // would generate a GET to /stores/123/items?category=Software
253
254
  Item.get({storeId: 123, id: 1}) // would generate a GET to /stores/123/items/1
254
255
 
255
256
  new Item({store: 123}).create() // would generate a POST to /stores/123/items
data/bower.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angularjs-rails-resource",
3
- "version": "1.2.0",
3
+ "version": "1.2.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.2.0'
4
+ VERSION = '1.2.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.2.0",
4
+ "version": "1.2.1",
5
5
  "main" : "dist/angularjs-rails-resource.min.js",
6
6
  "homepage" : "https://github.com/FineLinePrototyping/angularjs-rails-resource.git",
7
7
  "author" : "",
@@ -212,6 +212,27 @@ describe('interceptors', function () {
212
212
  });
213
213
  });
214
214
 
215
+ describe('beforeResponse', function() {
216
+ it('should run interceptor only once', function() {
217
+ var Resource, interceptorCalledCount = 0;
218
+
219
+ $httpBackend.expectGET('/test/123').respond(200, {id: 123, abc_def: 'xyz'});
220
+
221
+ Resource = factory(config);
222
+ Resource.addInterceptor({
223
+ 'beforeResponse': function (response, constructor, context) {
224
+ interceptorCalledCount++;
225
+ return response;
226
+ }
227
+ });
228
+
229
+ Resource.get(123)
230
+ $httpBackend.flush();
231
+
232
+ expect(interceptorCalledCount).toEqual(1);
233
+ });
234
+ });
235
+
215
236
  describe('response', function () {
216
237
  it('should be able to reference interceptor using name', function () {
217
238
  var promise, result, Resource, testConfig = {};
@@ -574,8 +574,6 @@
574
574
 
575
575
  }
576
576
 
577
- promise = this.runInterceptorPhase('beforeResponse', context, promise);
578
-
579
577
  promise = this.runInterceptorPhase('beforeResponse', context, promise).then(function (response) {
580
578
  // store off the data so we don't lose access to it after deserializing and unwrapping
581
579
  response.originalData = response.data;
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.2.0
4
+ version: 1.2.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-06-07 00:00:00.000000000 Z
12
+ date: 2014-09-28 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.2.2
84
+ rubygems_version: 2.1.9
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: AngularJS add-on resource add-on for integrating with Rails