jsonapi-rails 0.3.0 → 0.3.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: c4ddfbba5b18351a7d69d74537a47c821e717397
4
- data.tar.gz: 79ec8e0be87a8aa3110e0e927b449fbf46e85ce6
3
+ metadata.gz: 6c912f8bf18b7cb9aae401d121380b0d48e897d8
4
+ data.tar.gz: ca83afd750f861b825c11e2f5b44de19532e252b
5
5
  SHA512:
6
- metadata.gz: 8d2958f2136d6a613ade5d7a713dbfa7d12f4d6d233a1e23f119b2d8a2fd57d8052c9d821a2993b1377b6fa843b250cc4bf59b5205fcb345cdd98de7851083fd
7
- data.tar.gz: e42703a777344cc33da29a6a2ccae04f68f58c4fdcf399d5e20fedc30a7033c9646941aa2bd1b5712756e008999f11c2a782ffb1438f5c82fa6ac1300f9007c6
6
+ metadata.gz: 604a2e70580bfb24d1abe48a11fa6748128e05906ab324b13125addc6da362d36c2fd8371c6d14c06ddb5c13edf4bdd227a8474a2a21f90fb5256201f4c7c5eb
7
+ data.tar.gz: 5441fb97181fb8cae74f7bfd99de4107cf4ef5a2b8bf766bbadba2dcacac4059639b0ac2344aa267a4def895c9cd247656eb22f36c1e1522843f00068da071bf
@@ -1,7 +1,9 @@
1
- class InitializerGenerator < Rails::Generators::Base
2
- source_root File.expand_path('../templates', __FILE__)
1
+ module Jsonapi
2
+ class InitializerGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('../templates', __FILE__)
3
4
 
4
- def copy_initializer_file
5
- copy_file 'initializer.rb', 'config/initializers/jsonapi.rb'
5
+ def copy_initializer_file
6
+ copy_file 'initializer.rb', 'config/initializers/jsonapi.rb'
7
+ end
6
8
  end
7
9
  end
@@ -22,8 +22,9 @@ JSONAPI::Rails.configure do |config|
22
22
  # }
23
23
  #
24
24
  # # Set default exposures.
25
- # config.jsonapi_expose = {
26
- # url_helpers: ::Rails.application.routes.url_helpers
25
+ # # A lambda/proc that will be eval'd in the controller context.
26
+ # config.jsonapi_expose = lambda {
27
+ # { url_helpers: ::Rails.application.routes.url_helpers }
27
28
  # }
28
29
  #
29
30
  # # Set a default pagination scheme.
@@ -1,3 +1,4 @@
1
1
  require 'jsonapi/deserializable'
2
2
  require 'jsonapi/serializable'
3
+ require 'jsonapi/rails/configuration'
3
4
  require 'jsonapi/rails/railtie'
@@ -20,8 +20,8 @@ module JSONAPI
20
20
  version: '1.0'
21
21
  }.freeze
22
22
 
23
- DEFAULT_JSONAPI_EXPOSE = {
24
- url_helpers: ::Rails.application.routes.url_helpers
23
+ DEFAULT_JSONAPI_EXPOSE = lambda {
24
+ { url_helpers: ::Rails.application.routes.url_helpers }
25
25
  }.freeze
26
26
 
27
27
  DEFAULT_JSONAPI_PAGINATION = ->(_) { nil }
@@ -87,14 +87,14 @@ module JSONAPI
87
87
  # Overridden by the `class` renderer option.
88
88
  # @return [Hash{Symbol=>Class}]
89
89
  def jsonapi_class
90
- JSONAPI::Rails.config[:jsonapi_class]
90
+ JSONAPI::Rails.config[:jsonapi_class].dup
91
91
  end
92
92
 
93
93
  # Hook for serializable class mapping (for errors).
94
94
  # Overridden by the `class` renderer option.
95
95
  # @return [Hash{Symbol=>Class}]
96
96
  def jsonapi_errors_class
97
- JSONAPI::Rails.config[:jsonapi_errors_class]
97
+ JSONAPI::Rails.config[:jsonapi_errors_class].dup
98
98
  end
99
99
 
100
100
  # Hook for the jsonapi object.
@@ -107,7 +107,7 @@ module JSONAPI
107
107
  # Hook for default exposures.
108
108
  # @return [Hash]
109
109
  def jsonapi_expose
110
- JSONAPI::Rails.config[:jsonapi_expose]
110
+ instance_exec(&JSONAPI::Rails.config[:jsonapi_expose])
111
111
  end
112
112
 
113
113
  # Hook for pagination scheme.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Hosseini