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:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 6c912f8bf18b7cb9aae401d121380b0d48e897d8
         | 
| 4 | 
            +
              data.tar.gz: ca83afd750f861b825c11e2f5b44de19532e252b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 604a2e70580bfb24d1abe48a11fa6748128e05906ab324b13125addc6da362d36c2fd8371c6d14c06ddb5c13edf4bdd227a8474a2a21f90fb5256201f4c7c5eb
         | 
| 7 | 
            +
              data.tar.gz: 5441fb97181fb8cae74f7bfd99de4107cf4ef5a2b8bf766bbadba2dcacac4059639b0ac2344aa267a4def895c9cd247656eb22f36c1e1522843f00068da071bf
         | 
| @@ -1,7 +1,9 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
               | 
| 1 | 
            +
            module Jsonapi
         | 
| 2 | 
            +
              class InitializerGenerator < Rails::Generators::Base
         | 
| 3 | 
            +
                source_root File.expand_path('../templates', __FILE__)
         | 
| 3 4 |  | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 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 | 
            -
              #  | 
| 26 | 
            -
              # | 
| 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.
         | 
    
        data/lib/jsonapi/rails.rb
    CHANGED
    
    
| @@ -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.
         |