Class: Qiniu::Auth::PutPolicy
- Inherits:
-
Object
- Object
- Qiniu::Auth::PutPolicy
- Defined in:
- lib/qiniu/auth.rb
Overview
class << self
Instance Attribute Summary collapse
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
-
#allow_mime_list!(list) ⇒ Object
expires_in.
-
#deny_mime_list!(list) ⇒ Object
allow_mime_list!.
-
#detect_mime! ⇒ Object
insert_only!.
-
#expires_in ⇒ Object
expires_in=.
-
#expires_in!(seconds) ⇒ Object
scope!.
-
#expires_in=(seconds) ⇒ Object
expires_in!.
-
#insert_only! ⇒ Object
deny_mime_list!.
- #scope!(bucket, key = nil) ⇒ Object
-
#to_json ⇒ Object
detect_mime!.
Instance Attribute Details
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
66 67 68 |
# File 'lib/qiniu/auth.rb', line 66 def bucket @bucket end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
66 67 68 |
# File 'lib/qiniu/auth.rb', line 66 def key @key end |
Instance Method Details
#allow_mime_list!(list) ⇒ Object
expires_in
100 101 102 |
# File 'lib/qiniu/auth.rb', line 100 def allow_mime_list! (list) @mime_limit = list end |
#deny_mime_list!(list) ⇒ Object
allow_mime_list!
104 105 106 |
# File 'lib/qiniu/auth.rb', line 104 def deny_mime_list! (list) @mime_limit = "!#{list}" end |
#detect_mime! ⇒ Object
insert_only!
112 113 114 |
# File 'lib/qiniu/auth.rb', line 112 def detect_mime! @detect_mime = 1 end |
#expires_in ⇒ Object
expires_in=
96 97 98 |
# File 'lib/qiniu/auth.rb', line 96 def expires_in return @expires_in end |
#expires_in!(seconds) ⇒ Object
scope!
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/qiniu/auth.rb', line 81 def expires_in!(seconds) if !seconds.nil? then return @expires_in end @epires_in = seconds @deadline = Auth.calculate_deadline(seconds) return @expires_in end |
#expires_in=(seconds) ⇒ Object
expires_in!
92 93 94 |
# File 'lib/qiniu/auth.rb', line 92 def expires_in=(seconds) return expires_in!(seconds) end |
#insert_only! ⇒ Object
deny_mime_list!
108 109 110 |
# File 'lib/qiniu/auth.rb', line 108 def insert_only! @insert_only = 1 end |
#scope!(bucket, key = nil) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/qiniu/auth.rb', line 68 def scope!(bucket, key = nil) @bucket = bucket @key = key if key.nil? then # 新增语义,文件已存在则失败 @scope = bucket else # 覆盖语义,文件已存在则直接覆盖 @scope = "#{bucket}:#{key}" end end |
#to_json ⇒ Object
detect_mime!
116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/qiniu/auth.rb', line 116 def to_json args = {} PARAMS.each_pair do |key, fld| val = self.__send__(key) if !val.nil? then args[fld] = val end end return args.to_json end |