Sha256: 248cf842413b0e199c04f9ef544713f9b28af1adffd5c3de11ecd269e6435409

Contents?: true

Size: 961 Bytes

Versions: 135

Compression:

Stored size: 961 Bytes

Contents

module FakeS3
  class FakeS3Exception < RuntimeError
    attr_accessor :resource,:request_id

    def self.metaclass; class << self; self; end; end

    def self.traits(*arr)
      return @traits if arr.empty?
      attr_accessor *arr

      arr.each do |a|
        metaclass.instance_eval do
          define_method( a ) do |val|
            @traits ||= {}
            @traits[a] = val
          end
        end
      end

      class_eval do
        define_method( :initialize ) do
          self.class.traits.each do |k,v|
            instance_variable_set("@#{k}", v)
          end
        end
      end
    end

    traits :message,:http_status

    def code
      self.class.to_s
    end
  end

  class NoSuchBucket < FakeS3Exception
    message "The bucket you tried to delete is not empty."
    http_status "404"
  end

  class BucketNotEmpty < FakeS3Exception
    message "The bucket you tried to delete is not empty."
    http_status "409"
  end

end

Version data entries

135 entries across 135 versions & 27 rubygems

Version Path
plntr-fakes3-1.0.0.pre.9test lib/fakes3/errors.rb
fakes3-2.0.0 lib/fakes3/errors.rb
fakes3-1.3.1 lib/fakes3/errors.rb
fakes3-1.3.0 lib/fakes3/errors.rb
plntr-fakes3-1.0.0.pre.8 lib/fakes3/errors.rb
fakes3-1.2.1 lib/fakes3/errors.rb
fakes3t1-1.2.0 lib/fakes3/errors.rb
fakes3testing2-1.2.0 lib/fakes3/errors.rb
fakes3testing1-1.2.0 lib/fakes3/errors.rb
fakes3s37-1.2.0 lib/fakes3/errors.rb
fakes3test12-1.2.0 lib/fakes3/errors.rb
fakes3test11-1.2.0 lib/fakes3/errors.rb
fakes3test10-1.2.0 lib/fakes3/errors.rb
fakes3test9-1.2.0 lib/fakes3/errors.rb
fakes3test8-1.2.0 lib/fakes3/errors.rb
fakes3test7-1.2.0 lib/fakes3/errors.rb
fakes3test6-1.2.0 lib/fakes3/errors.rb
fakes3test5-1.2.0 lib/fakes3/errors.rb
fakes3test4-1.2.0 lib/fakes3/errors.rb
fakes3test2-1.2.0 lib/fakes3/errors.rb