revelry_data 0.0.14 → 0.0.15

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: 1e50d8ff5a38c9ebc9f025d6d2071037649d3c02
4
- data.tar.gz: b398499f4959cc8fe0cbc0af778cd581a2d41806
3
+ metadata.gz: d499b1c3e5bf1c2b32b9889a0e0f7bf1153dc8f9
4
+ data.tar.gz: 9be265367378e45c773dc2b8e49256c0589f16ac
5
5
  SHA512:
6
- metadata.gz: 3dd38dad98c3e8fc14312455f303f9665a66f142571dca818b251ef969e53d0f7e68fd46a9650be5d6762f5677479d996aa9f867375b9dd2fa63ad349075fb45
7
- data.tar.gz: 3341bdb1d470a9395ce9a3e712130578aa165dc7cd28066708c3c447fb67e3d87372333fcfbbbad3854581f3c8b73398d6dc6d22b6617e7437907027368a7503
6
+ metadata.gz: 8e6ed3a95b74b66dc6dfa8824fa166dcaf09047564ee3821c0c65cc2d219f8023146b9faf3ab522c06c876bd70f94511ad57681b93d715134bfd9949805da914
7
+ data.tar.gz: 81f53e67125f304989ad9696d1ff620aaa149165e57c8ff76117a5cf6edce1f28aad2f027eac38a8c8fa75be1c547d72c1ed85f232173c5c5c445a0e07671e6f
@@ -280,16 +280,16 @@ class CollectionQueryParameters {
280
280
  get fetchData() {
281
281
  // Pagination options
282
282
  let params = {
283
- page: {},
283
+ page: this.page
284
284
  }
285
285
 
286
286
  // The size option if set, otherwise skip
287
287
  if(this.paginatorType === "paged") {
288
- _.extend(params.page, {size: this.size, number: this.page})
288
+ params.page = {size: this.size, number: this.page}
289
289
  }
290
290
 
291
291
  if(this.paginatorType === "offset") {
292
- _.extend(params.page, {limit: this.limit, offset: this.offset})
292
+ params.page = {limit: this.limit, offset: this.offset}
293
293
  }
294
294
 
295
295
  // The sort option if set, otherwise skip
@@ -8,5 +8,10 @@ module RevelryData
8
8
  config.always_include_to_many_linkage_data = true
9
9
  end
10
10
  end
11
+
12
+ initializer 'revelry_data.blacklist_props', after: 'execjs_rails.setup_view_helpers' do |app|
13
+ break unless defined?(ExecJS::Rails)
14
+ config.execjs_rails.blacklisted_assigns += %w(request response)
15
+ end
11
16
  end
12
17
  end
@@ -38,8 +38,20 @@ JSONAPI::Request.class_eval do
38
38
  @operations.push JSONAPI::NewOperation.new(
39
39
  @resource_klass,
40
40
  {
41
- include_directives: @include_directives
41
+ context: @context,
42
+ include_directives: @include_directives,
42
43
  }
43
44
  )
44
45
  end
45
46
  end
47
+
48
+ JSONAPI::ActsAsResourceController.class_eval do
49
+ def base_response_meta
50
+ {
51
+ current_user: current_user,
52
+ csrf_token: form_authenticity_token,
53
+ current_org: current_user.try(:org),
54
+ flashes: flash,
55
+ }
56
+ end
57
+ end
@@ -1,63 +1,86 @@
1
1
  module RevelryData
2
2
  module Resource
3
3
  extend ActiveSupport::Concern
4
- include JSONAPI::ActsAsResourceController
5
4
 
6
5
  included do
6
+ include JSONAPI::ActsAsResourceController
7
7
  respond_to :html, :json, :props
8
8
  before_filter :setup_request
9
- end
10
9
 
11
- def new
12
- process_request_operations
13
- end
10
+ def new
11
+ if respond_to? :process_request_operations
12
+ process_request_operations
13
+ else
14
+ process_request
15
+ end
16
+ end
14
17
 
15
- def setup_request
16
- @request = JSONAPI::Request.new(params, {
17
- context: context,
18
- key_formatter: key_formatter
19
- })
20
- render_errors(@request.errors) unless @request.errors.empty?
21
- rescue => e
22
- handle_exceptions(e)
23
- end
18
+ def setup_request
19
+ @request = JSONAPI::Request.new(params, {
20
+ context: context,
21
+ key_formatter: key_formatter
22
+ })
23
+ render_errors(@request.errors) unless @request.errors.empty?
24
+ rescue => e
25
+ handle_exceptions(e)
26
+ end
24
27
 
25
- def fmt_is_json_api?
26
- request.format == 'json'
27
- end
28
+ def process_request
29
+ @request = JSONAPI::Request.new(params, context: context,
30
+ key_formatter: key_formatter,
31
+ server_error_callbacks: (self.class.server_error_callbacks || []))
32
+ unless @request.errors.empty?
33
+ render_errors(@request.errors)
34
+ else
35
+ operation_results = create_operations_processor.process(@request)
36
+ render_results(operation_results)
37
+ end
28
38
 
29
- def setup_response
30
- return unless fmt_is_json_api?
39
+ rescue => e
40
+ handle_exceptions(e)
41
+ ensure
42
+ if response.body.size > 0 && fmt_is_json_api?
43
+ response.headers['Content-Type'] = JSONAPI::MEDIA_TYPE
44
+ end
45
+ end
31
46
 
32
- if response.body.size > 0
33
- response.headers['Content-Type'] = JSONAPI::MEDIA_TYPE
47
+ def fmt_is_json_api?
48
+ request.format == 'json'
34
49
  end
35
- end
36
50
 
37
- def render_results(operation_results)
38
- response_doc = create_response_document(operation_results)
51
+ def setup_response
52
+ return unless fmt_is_json_api?
39
53
 
40
- respond_with response_doc.contents do |fmt|
41
- fmt.html do
42
- @json_api = response_doc.contents
43
- render status: response_doc.status
54
+ if response.body.size > 0
55
+ response.headers['Content-Type'] = JSONAPI::MEDIA_TYPE
44
56
  end
45
- fmt.json do
46
- render json: response_doc.contents, status: response_doc.status
47
- end
48
- fmt.props do
49
- render json: response_doc.contents, status: response_doc.status
57
+ end
58
+
59
+ def render_results(operation_results)
60
+ response_doc = create_response_document(operation_results)
61
+
62
+ respond_with response_doc.contents do |fmt|
63
+ fmt.html do
64
+ @json_api = response_doc.contents
65
+ render status: response_doc.status
66
+ end
67
+ fmt.json do
68
+ render json: response_doc.contents, status: response_doc.status
69
+ end
70
+ fmt.props do
71
+ render json: response_doc.contents, status: response_doc.status
72
+ end
50
73
  end
51
74
  end
52
- end
53
75
 
54
- def base_response_meta
55
- {
56
- current_user: current_user,
57
- csrf_token: form_authenticity_token,
58
- current_org: current_user.try(:org),
59
- flashes: flash,
60
- }
76
+ def base_response_meta
77
+ {
78
+ current_user: current_user,
79
+ csrf_token: form_authenticity_token,
80
+ current_org: current_user.try(:org),
81
+ flashes: flash,
82
+ }
83
+ end
61
84
  end
62
85
  end
63
86
  end
@@ -1,3 +1,3 @@
1
1
  module RevelryData
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  module RevelryData
2
2
  <<<<<<< HEAD
3
- VERSION = "0.0.12"
3
+ VERSION = "0.0.13"
4
4
  =======
5
- VERSION = "0.1.2"
6
- >>>>>>> 936d168df25b6786791e8cc1dac501aebfeb45e7
5
+ VERSION = "0.1.4"
6
+ >>>>>>> 20b9385c796e405df43a99ae4a9cc5ad8838663f
7
7
  end
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.14
4
+ version: 0.0.15
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-03-17 00:00:00.000000000 Z
11
+ date: 2016-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -1316,3 +1316,4 @@ test_files:
1316
1316
  - spec/javascripts/support/jasmine.yml
1317
1317
  - spec/revelry_data_test.rb
1318
1318
  - spec/spec_helper.rb
1319
+ has_rdoc: