echo_uploads 0.0.13 → 0.0.14
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 +4 -4
 - data/lib/echo_uploads/model.rb +20 -0
 - data/lib/echo_uploads/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c825aebbee0892448c87fe8ebdaa444e34f9c5b4
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 81e02dd1c89d5ca630b6474bc7462d50908c7ab1
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: af5bf823ba0b90118b26850a43c3301bbe152a5019325bd6cc747c8b4bc94f6bdfad0ba4bc440d567059e7635776c8892b2ffb73fe3e637f894282b973872c61
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 80c001c00413726cf371bf1f76003a82824c909b3440c14846a35939f3604b92a456dd2b490ec9a48eb41b9c347ed50d9e985f38508bf12a51cf0f6a145e10c0
         
     | 
    
        data/lib/echo_uploads/model.rb
    CHANGED
    
    | 
         @@ -151,6 +151,26 @@ module EchoUploads 
     | 
|
| 
       151 
151 
     | 
    
         
             
                      echo_uploads_map_metadata(attr, options, &:key)
         
     | 
| 
       152 
152 
     | 
    
         
             
                    end
         
     | 
| 
       153 
153 
     | 
    
         | 
| 
      
 154 
     | 
    
         
            +
                    # Define the storage method.
         
     | 
| 
      
 155 
     | 
    
         
            +
                    define_method("#{attr}_storage") do
         
     | 
| 
      
 156 
     | 
    
         
            +
                      echo_uploads_map_metadata(attr, options, &:storage)
         
     | 
| 
      
 157 
     | 
    
         
            +
                    end
         
     | 
| 
      
 158 
     | 
    
         
            +
                    
         
     | 
| 
      
 159 
     | 
    
         
            +
                    # Define the url method.
         
     | 
| 
      
 160 
     | 
    
         
            +
                    define_method("#{attr}_url") do |options = {}|
         
     | 
| 
      
 161 
     | 
    
         
            +
                      echo_uploads_map_metadata(attr, options) do |meta|
         
     | 
| 
      
 162 
     | 
    
         
            +
                        if meta.storage.respond_to?(:url)
         
     | 
| 
      
 163 
     | 
    
         
            +
                          meta.storage.url meta.key, options
         
     | 
| 
      
 164 
     | 
    
         
            +
                        else
         
     | 
| 
      
 165 
     | 
    
         
            +
                          raise(
         
     | 
| 
      
 166 
     | 
    
         
            +
                            NoMethodError,
         
     | 
| 
      
 167 
     | 
    
         
            +
                            "The Echo Uploads file store you've selected, " +
         
     | 
| 
      
 168 
     | 
    
         
            +
                            "{meta.storage.class.to_s}, does not support the #url method."
         
     | 
| 
      
 169 
     | 
    
         
            +
                          )
         
     | 
| 
      
 170 
     | 
    
         
            +
                        end
         
     | 
| 
      
 171 
     | 
    
         
            +
                      end
         
     | 
| 
      
 172 
     | 
    
         
            +
                    end
         
     | 
| 
      
 173 
     | 
    
         
            +
                    
         
     | 
| 
       154 
174 
     | 
    
         
             
                    # Define the has_x? method. Returns true if a permanent or temporary file has been
         
     | 
| 
       155 
175 
     | 
    
         
             
                    # persisted, or if a file (which may not be valid) has been uploaded this request
         
     | 
| 
       156 
176 
     | 
    
         
             
                    # cycle.
         
     | 
    
        data/lib/echo_uploads/version.rb
    CHANGED