revelry_data 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3279b32fff31dc2456be44d33a8beae8b6164459
4
- data.tar.gz: 21c143bf59b92b2e65fe0db741508d8519ce2e97
3
+ metadata.gz: 93d8ee7d9d743658c83f4c817857bc8af436fd6a
4
+ data.tar.gz: b0a1e2e1973fcf8ccad5f94fe2171575b27443bf
5
5
  SHA512:
6
- metadata.gz: cd499614bda1ab94ce81ecaa62397d15818dc66088fb3ebf32d5d69abd48aae9a92554954ed91cb54b3fbc62063eb629746e05d0b9612843b864a7b6ccac295d
7
- data.tar.gz: 72cd5a587b878f51d351a9a4bad7facdd74ea3e659b05125384ed2ce9cf44369784e9357a7b8a03a8a5fb261930a0440dd7e8dd718f9fac54f863fe3c9e3dde1
6
+ metadata.gz: 45c6973007a7022d1055810ab62d06da47125e4f07d7cb1c568c88024919a6a5f8acb349a4ba01e2938b7eadd99736c4654d9be20c2eecc674b32b0a3068b44e
7
+ data.tar.gz: d24734ad94162dffd801ff2f457a1433b8f2f568d2575fd2ebdcb9c9f59f3ea08114ca7f67387876e4bbf31f32073d6abd561175e18bdc68b512b36e42a30106
@@ -81,9 +81,23 @@ class BaseModel extends Backbone.Model {
81
81
  return base.replace(/([^\/])$/, '$1/') + encodeURIComponent(this.id) + this.formatPostfix(opts)
82
82
  }
83
83
 
84
+ // Map through the relationship object and remove 'cid' field and remove
85
+ // relationship if its empty
86
+ relationshipData() {
87
+ return _.mapObject(this.get('relationships'), (relationship) => {
88
+ if (!relationship.data) return
89
+ return _.extend(relationship, {
90
+ data: _.mapIfArray(
91
+ relationship.data,
92
+ (data) => _.omit(data, 'cid')
93
+ )
94
+ })
95
+ })
96
+ }
97
+
84
98
  // Wrap the JSON representation in 'data' to make JSON API happy
85
99
  toJSON(options) {
86
- var key = {id: this.id, type: this.get('type'), relationships: this.get('relationships')}
100
+ var key = {id: this.id, type: this.get('type'), relationships: this.relationshipData()}
87
101
  var inner = _(super.toJSON(options)).omit('links', 'id', 'type', 'attributes', 'relationships')
88
102
  return { data: _.extend({attributes: inner}, key) }
89
103
  }
@@ -65,6 +65,10 @@ class CollectionQueryParameters {
65
65
  * @param {String} newValue - the new value of the filter to apply
66
66
  */
67
67
  setFilter(filterName, newValue) {
68
+ // if filter changes, reset pagination
69
+ if (this.filters[filterName] !== newValue) {
70
+ this.resetPage()
71
+ }
68
72
  this.filters[filterName] = newValue
69
73
  this.maybeFetch()
70
74
  }
@@ -1,3 +1,3 @@
1
1
  module RevelryData
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revelry_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Prehn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-22 00:00:00.000000000 Z
11
+ date: 2015-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.2.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.2.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: jsonapi-resources
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: revelry_core
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.1.8
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.1.8
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sqlite3
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: jasmine-rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: Revelry Data is a library for managing data within React applications
@@ -719,17 +719,17 @@ require_paths:
719
719
  - lib
720
720
  required_ruby_version: !ruby/object:Gem::Requirement
721
721
  requirements:
722
- - - '>='
722
+ - - ">="
723
723
  - !ruby/object:Gem::Version
724
724
  version: '0'
725
725
  required_rubygems_version: !ruby/object:Gem::Requirement
726
726
  requirements:
727
- - - '>='
727
+ - - ">="
728
728
  - !ruby/object:Gem::Version
729
729
  version: '0'
730
730
  requirements: []
731
731
  rubyforge_project:
732
- rubygems_version: 2.4.6
732
+ rubygems_version: 2.2.2
733
733
  signing_key:
734
734
  specification_version: 4
735
735
  summary: Revelry Data is a library for managing data within React applications using