aboutsummaryrefslogblamecommitdiffstats
path: root/lib/active_storage/service.rb
blob: 0d0ebf6010d899dc9f3d90afab9395ba1bf14aaa (plain) (tree)
1
2
3
4
5
6
7
8


                                                               
         

                                                                           
                         
                                                                  


       
 
                     
                             


                   
                             


                 
                             

     
                 
                             

     
                                                    
                             
     
   
# Abstract class serving as an interface for concrete services.
class ActiveStorage::Service
  def self.configure(service, **options)
    begin
      require "active_storage/service/#{service.to_s.downcase}_service"
      ActiveStorage::Service.const_get(:"#{service}Service").new(**options)
    rescue LoadError => e
      puts "Couldn't configure service: #{service} (#{e.message})"
    end
  end


  def upload(key, io)
    raise NotImplementedError
  end

  def download(key)
    raise NotImplementedError
  end

  def delete(key)
    raise NotImplementedError
  end

  def exist?(key)
    raise NotImplementedError
  end

  def url(key, expires_in:, disposition:, filename:)
    raise NotImplementedError
  end
end