qiniu / ruby-sdk

Qiniu Resource (Cloud) Storage SDK for Ruby
MIT License
164 stars 138 forks source link

关于上传策略初始化的疑问 #158

Closed dylanninin closed 8 years ago

dylanninin commented 8 years ago

https://github.com/qiniu/ruby-sdk/blob/master/lib/qiniu/auth.rb 中,在初始化 PutPolicy 时,只能传递 bucket, key, expires_in, deadline 等4个参数:

      class PutPolicy
        private
        def initialize(bucket,
                       key = nil,
                       expires_in = DEFAULT_AUTH_SECONDS,
                       deadline = nil)
       ....

若有其他的 policy(如 mimeLimit),则须使用如下方式进行设置:

@put_policy = Qiniu::Auth::PutPolicy.new(bucket.name, nil, bucket.expires_in)
@put_policy.mime_limit = Settings.qiniu.policy.mimeLimit

实际使用时可能有很多policy,这样逐一赋值很麻烦,是否考虑 PutPolicy 可以接收更多的参数呢?

参考:

longbai commented 8 years ago

收到,我们考虑下