revelry_data 0.0.15 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d499b1c3e5bf1c2b32b9889a0e0f7bf1153dc8f9
4
- data.tar.gz: 9be265367378e45c773dc2b8e49256c0589f16ac
3
+ metadata.gz: 941b631f89ccb04d292163dd7fc343f30b4d1c26
4
+ data.tar.gz: 0cd2218849f1704da95160d678c246168c287a4f
5
5
  SHA512:
6
- metadata.gz: 8e6ed3a95b74b66dc6dfa8824fa166dcaf09047564ee3821c0c65cc2d219f8023146b9faf3ab522c06c876bd70f94511ad57681b93d715134bfd9949805da914
7
- data.tar.gz: 81f53e67125f304989ad9696d1ff620aaa149165e57c8ff76117a5cf6edce1f28aad2f027eac38a8c8fa75be1c547d72c1ed85f232173c5c5c445a0e07671e6f
6
+ metadata.gz: 02747c0200c3a7f0989768a819390f2d7b38a2bb396a0af4e801f2a519aaf2bc44e90174cf8c3808558f6eca30bb69961125c5ede1ee5753d5e262b83ab4a547
7
+ data.tar.gz: a867a944244f160f78c1bec9fc7a18f3acd6db77fafdb84003dc3cf73e97233cbafa82522413db2f98be6f101188f2d249572407537021c80780242c758b841d
@@ -65,7 +65,7 @@ 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
68
+ // if filter changes, reset pagination
69
69
  if (this.filters[filterName] !== newValue) {
70
70
  this.resetPage()
71
71
  }
@@ -96,38 +96,6 @@ class CollectionQueryParameters {
96
96
  this.page = n
97
97
  }
98
98
 
99
- /**
100
- * Get the currently selected paginaion size
101
- */
102
- getSize() {
103
- return this.size
104
- }
105
-
106
- /**
107
- * Set the selected size to a new value and fetch is `fetchExplicitly` is
108
- * `false`
109
- * @param {Integer} n - the new size number
110
- */
111
- setSize(n) {
112
- this.size = n
113
- }
114
-
115
- /**
116
- * Get the currently selected pagination limit
117
- */
118
- getLimit() {
119
- return this.offset
120
- }
121
-
122
- /**
123
- * Set the selected limit to a new value and fetch is `fetchExplicitly` is
124
- * `false`
125
- * @param {Integer} n - the new limit number
126
- */
127
- setLimit(n) {
128
- this.limit = n
129
- }
130
-
131
99
  /**
132
100
  * Get the currently selected page number (1 by default)
133
101
  */
@@ -161,34 +129,6 @@ class CollectionQueryParameters {
161
129
  this.maybeFetch()
162
130
  }
163
131
 
164
- /**
165
- * Set the selected size to a new value, limit to null, resets page
166
- * and fetch is `fetchExplicitly` is `false`
167
- * https://github.com/cerebris/jsonapi-resources#paged-paginator
168
- * @param {Integer} n - the new pagination size
169
- */
170
-
171
- set size(n) {
172
- this._size = n
173
- this._limit = null
174
- this.resetPage()
175
- this.maybeFetch()
176
- }
177
-
178
- /**
179
- * Set the selected limit to a new value, size to null, resets page
180
- * and fetch is `fetchExplicitly` is `false`
181
- * https://github.com/cerebris/jsonapi-resources#offset-paginator
182
- * @param {Integer} n - the new pagination limit
183
- */
184
-
185
- set limit(n) {
186
- this._limit = n
187
- this._size = null
188
- this.resetPage()
189
- this.maybeFetch()
190
- }
191
-
192
132
  /**
193
133
  * Get the currently selected page number (1 by default)
194
134
  */
@@ -196,47 +136,6 @@ class CollectionQueryParameters {
196
136
  return this._page || 1
197
137
  }
198
138
 
199
- get offset(){
200
- if(this.page > 1){
201
- return (this.page - 1) * this.limit
202
- }
203
-
204
- return 0;
205
- }
206
-
207
- /**
208
- * Get the currently selected size for pagination
209
- */
210
-
211
- get size() {
212
- return this._size
213
- }
214
-
215
- /**
216
- * Get the currently selected limit for pagination
217
- */
218
-
219
- get limit() {
220
- return this._limit
221
- }
222
-
223
- /**
224
- * Get the currently selected paginator type:
225
- * If size exist it returns paged
226
- * If limit exist it returns offset
227
- * If no-one exist it returns nil for backward compatibility
228
- */
229
-
230
- get paginatorType() {
231
- if(this.size){
232
- return "paged"
233
- }
234
-
235
- if(this.limit){
236
- return "offset"
237
- }
238
- }
239
-
240
139
  /**
241
140
  * Set the page back to page 1. Frequently we do this when changing sorting
242
141
  * or filtering options so that the user is not disoriented in the result set.
@@ -280,18 +179,8 @@ class CollectionQueryParameters {
280
179
  get fetchData() {
281
180
  // Pagination options
282
181
  let params = {
283
- page: this.page
284
- }
285
-
286
- // The size option if set, otherwise skip
287
- if(this.paginatorType === "paged") {
288
- params.page = {size: this.size, number: this.page}
182
+ page: this.page,
289
183
  }
290
-
291
- if(this.paginatorType === "offset") {
292
- params.page = {limit: this.limit, offset: this.offset}
293
- }
294
-
295
184
  // The sort option if set, otherwise skip
296
185
  if(this.sort) {
297
186
  _.extend(params, {sort: this.sort})
@@ -17,8 +17,8 @@ module JSONAPI
17
17
  super(resource_klass, options)
18
18
  end
19
19
 
20
- def apply
21
- resource_record = resource_klass.create(@context)
20
+ def apply(context)
21
+ resource_record = resource_klass.create(context)
22
22
  return JSONAPI::ResourceOperationResult.new(:ok, resource_record)
23
23
 
24
24
  rescue JSONAPI::Exceptions::Error => e
@@ -38,8 +38,7 @@ JSONAPI::Request.class_eval do
38
38
  @operations.push JSONAPI::NewOperation.new(
39
39
  @resource_klass,
40
40
  {
41
- context: @context,
42
- include_directives: @include_directives,
41
+ include_directives: @include_directives
43
42
  }
44
43
  )
45
44
  end
@@ -1,3 +1,3 @@
1
1
  module RevelryData
2
- VERSION = "0.0.15"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/revelry_data.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require "revelry_core"
2
2
  require "jsonapi-resources"
3
3
  require "revelry_data/jsonapi_resources_patch"
4
- require "revelry_data/jsonapi_resources_routing_patch"
5
4
  require "revelry_data/resource_controller_concern"
6
5
  require "revelry_data/engine"
7
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revelry_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Prehn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2016-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.6.0
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
- version: 0.6.0
40
+ version: '0.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: revelry_core
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -127,10 +127,8 @@ files:
127
127
  - lib/revelry_data.rb
128
128
  - lib/revelry_data/engine.rb
129
129
  - lib/revelry_data/jsonapi_resources_patch.rb
130
- - lib/revelry_data/jsonapi_resources_routing_patch.rb
131
130
  - lib/revelry_data/resource_controller_concern.rb
132
131
  - lib/revelry_data/version.rb
133
- - lib/revelry_data/version.rb.orig
134
132
  - lib/tasks/revelry_data_tasks.rake
135
133
  - spec/dummy/README.rdoc
136
134
  - spec/dummy/Rakefile
@@ -731,7 +729,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
731
729
  version: '0'
732
730
  requirements: []
733
731
  rubyforge_project:
734
- rubygems_version: 2.4.5.1
732
+ rubygems_version: 2.2.2
735
733
  signing_key:
736
734
  specification_version: 4
737
735
  summary: Revelry Data is a library for managing data within React applications using
@@ -1316,4 +1314,3 @@ test_files:
1316
1314
  - spec/javascripts/support/jasmine.yml
1317
1315
  - spec/revelry_data_test.rb
1318
1316
  - spec/spec_helper.rb
1319
- has_rdoc:
@@ -1,58 +0,0 @@
1
- # This exists because JSON API Resources won't let you route to 'new' or 'edit'
2
- # and clobbers the value of the :except param to jsonapi_resources
3
- # In order to support new and edit forms we have to patch these routing helpers
4
- # for now
5
- module ActionDispatch
6
- module Routing
7
- class Mapper
8
- Resources.class_eval do
9
- def jsonapi_resource(*resources, &_block)
10
- @resource_type = resources.first
11
- res = JSONAPI::Resource.resource_for(resource_type_with_module_prefix(@resource_type))
12
-
13
- options = resources.extract_options!.dup
14
- options[:controller] ||= @resource_type
15
- options.merge!(res.routing_resource_options)
16
- options[:path] = format_route(@resource_type)
17
-
18
- resource @resource_type, options do
19
- @scope[:jsonapi_resource] = @resource_type
20
-
21
- if block_given?
22
- yield
23
- else
24
- jsonapi_relationships
25
- end
26
- end
27
- end
28
-
29
- def jsonapi_resources(*resources, &_block)
30
- @resource_type = resources.first
31
- res = JSONAPI::Resource.resource_for(resource_type_with_module_prefix(@resource_type))
32
-
33
- options = resources.extract_options!.dup
34
- options[:controller] ||= @resource_type
35
- options.merge!(res.routing_resource_options)
36
-
37
- options[:param] = :id
38
-
39
- options[:path] = format_route(@resource_type)
40
-
41
- if res.resource_key_type == :uuid
42
- options[:constraints] = {id: /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}(,[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})*/}
43
- end
44
-
45
- resources @resource_type, options do
46
- @scope[:jsonapi_resource] = @resource_type
47
-
48
- if block_given?
49
- yield
50
- else
51
- jsonapi_relationships
52
- end
53
- end
54
- end
55
- end
56
- end
57
- end
58
- end
@@ -1,7 +0,0 @@
1
- module RevelryData
2
- <<<<<<< HEAD
3
- VERSION = "0.0.13"
4
- =======
5
- VERSION = "0.1.4"
6
- >>>>>>> 20b9385c796e405df43a99ae4a9cc5ad8838663f
7
- end