snfoil-rails 0.4.6 → 0.5.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 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 28a1f49800c3ca49e322970d28d6ec119e686a04d2bdac14d2a42099d7cac976
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 194ca6911b6272a6805893fcc5e05af4e60a05697516e617c8ed8b6f93e0d2cf
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 5b62cb7a7c0da0deb684e6d9bcc41f23848f3de1c9abc69c7878ac075ecad496e2ae63be579c23a093369f73b616a18b87347c59026fee78774d37f70833ba6d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: da6331fea3c1d892ff7c901a79a3d1861eee9479c1f77f9e5fd82cf709c0c2a64d8b061d7f130f5835c6b86cb3613bb80014472404b031eb38df2cd5e5d429c9
         
     | 
| 
         @@ -40,7 +40,8 @@ module SnFoil 
     | 
|
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
                  def render_change(model, **options)
         
     | 
| 
       42 
42 
     | 
    
         
             
                    if model.errors.empty?
         
     | 
| 
       43 
     | 
    
         
            -
                       
     | 
| 
      
 43 
     | 
    
         
            +
                      params
         
     | 
| 
      
 44 
     | 
    
         
            +
                      render json: serializer(**options).new(model, **options.merge, params: { current_entity: current_entity }).serializable_hash
         
     | 
| 
       44 
45 
     | 
    
         
             
                    else
         
     | 
| 
       45 
46 
     | 
    
         
             
                      render json: model.errors, status: :unprocessable_entity
         
     | 
| 
       46 
47 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -55,12 +56,15 @@ module SnFoil 
     | 
|
| 
       55 
56 
     | 
    
         
             
                  end
         
     | 
| 
       56 
57 
     | 
    
         | 
| 
       57 
58 
     | 
    
         
             
                  def render_index(results, **options)
         
     | 
| 
       58 
     | 
    
         
            -
                    render json: serializer(**options).new(paginate(results, **options), 
     | 
| 
      
 59 
     | 
    
         
            +
                    render json: serializer(**options).new(paginate(results, **options),
         
     | 
| 
      
 60 
     | 
    
         
            +
                                                           **options,
         
     | 
| 
      
 61 
     | 
    
         
            +
                                                           params: { current_entity: current_entity },
         
     | 
| 
      
 62 
     | 
    
         
            +
                                                           meta: meta(results, **options))
         
     | 
| 
       59 
63 
     | 
    
         
             
                                                      .serializable_hash
         
     | 
| 
       60 
64 
     | 
    
         
             
                  end
         
     | 
| 
       61 
65 
     | 
    
         | 
| 
       62 
66 
     | 
    
         
             
                  def render_show(model, **options)
         
     | 
| 
       63 
     | 
    
         
            -
                    render json: serializer(**options).new(model, **options).serializable_hash
         
     | 
| 
      
 67 
     | 
    
         
            +
                    render json: serializer(**options).new(model, **options, params: { current_entity: current_entity }).serializable_hash
         
     | 
| 
       64 
68 
     | 
    
         
             
                  end
         
     | 
| 
       65 
69 
     | 
    
         | 
| 
       66 
70 
     | 
    
         
             
                  private
         
     | 
| 
         @@ -28,7 +28,7 @@ module SnFoil 
     | 
|
| 
       28 
28 
     | 
    
         
             
                    end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
                    def current_context(**options)
         
     | 
| 
       31 
     | 
    
         
            -
                      @current_context ||= context(**options).new( 
     | 
| 
      
 31 
     | 
    
         
            +
                      @current_context ||= context(**options).new(context_entity)
         
     | 
| 
       32 
32 
     | 
    
         
             
                    end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
                    protected
         
     | 
| 
         @@ -75,7 +75,8 @@ module SnFoil 
     | 
|
| 
       75 
75 
     | 
    
         
             
                      options
         
     | 
| 
       76 
76 
     | 
    
         
             
                    end
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
                    def  
     | 
| 
      
 78 
     | 
    
         
            +
                    def context_entity
         
     | 
| 
      
 79 
     | 
    
         
            +
                      return current_entity if defined? current_entity
         
     | 
| 
       79 
80 
     | 
    
         
             
                      return current_user if defined? current_user
         
     | 
| 
       80 
81 
     | 
    
         
             
                    end
         
     | 
| 
       81 
82 
     | 
    
         
             
                  end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: snfoil-rails
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Matthew Howes
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2020- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2020-04-16 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: activesupport
         
     | 
| 
         @@ -45,14 +45,14 @@ dependencies: 
     | 
|
| 
       45 
45 
     | 
    
         
             
                requirements:
         
     | 
| 
       46 
46 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       47 
47 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       48 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 48 
     | 
    
         
            +
                    version: '0.5'
         
     | 
| 
       49 
49 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       50 
50 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       51 
51 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       52 
52 
     | 
    
         
             
                requirements:
         
     | 
| 
       53 
53 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       54 
54 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       55 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 55 
     | 
    
         
            +
                    version: '0.5'
         
     | 
| 
       56 
56 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       57 
57 
     | 
    
         
             
              name: bundler
         
     | 
| 
       58 
58 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     |