qiniu-rs 3.4.0 → 3.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## CHANGE LOG
2
2
 
3
+ ### v3.4.1
4
+
5
+ 增加为上传文件进行预转的选项,参见 [uploadToken 之 asyncOps 说明](http://docs.qiniutek.com/v3/api/io/#uploadToken-asyncOps)
6
+
7
+ - `Qiniu::RS.generate_upload_token()` 方法新增 `:async_options` 选项用于进行预转操作。
8
+
3
9
  ### v3.4.0
4
10
 
5
11
  增加文件复制/移动方法,包括批量复制/移动文件
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qiniu-rs (3.4.0)
4
+ qiniu-rs (3.4.1)
5
5
  json (~> 1.7)
6
6
  mime-types (~> 1.19)
7
7
  rest-client (~> 1.6)
data/docs/README.md CHANGED
@@ -125,7 +125,8 @@ title: Ruby SDK 使用指南 | 七牛云存储
125
125
  :callback_url => callback_url,
126
126
  :callback_body_type => callback_body_type,
127
127
  :customer => end_user_id,
128
- :escape => allow_upload_callback_api
128
+ :escape => allow_upload_callback_api,
129
+ :async_options => async_callback_api_commands
129
130
 
130
131
  **参数**
131
132
 
@@ -157,6 +158,9 @@ title: Ruby SDK 使用指南 | 七牛云存储
157
158
 
158
159
  `foo=bar&w=$(imageInfo.width)&h=$(imageInfo.height)&exif=$(exif)`
159
160
 
161
+ :async_options
162
+ : 可选,字符串类型(String),用于设置文件上传成功后,执行指定的预转指令。参见 [uploadToken 之 asyncOps 说明](http://docs.qiniutek.com/v3/api/io/#uploadToken-asyncOps)
163
+
160
164
  **返回值**
161
165
 
162
166
  返回一个字符串类型(String)的用于上传文件用的临时授权 `upload_token`。
@@ -5,7 +5,7 @@ module Qiniu
5
5
  module Version
6
6
  MAJOR = 3
7
7
  MINOR = 4
8
- PATCH = 0
8
+ PATCH = 1
9
9
  # Returns a version string by joining <tt>MAJOR</tt>, <tt>MINOR</tt>, and <tt>PATCH</tt> with <tt>'.'</tt>
10
10
  #
11
11
  # Example
data/lib/qiniu/rs.rb CHANGED
@@ -252,6 +252,7 @@ module Qiniu
252
252
  #token_obj.callback_body_type = opts[:callback_body_type]
253
253
  #token_obj.customer = opts[:customer]
254
254
  #token_obj.escape = opts[:escape]
255
+ #token_obj.async_options = opts[:async_options]
255
256
  token_obj.generate_token
256
257
  end
257
258
 
@@ -10,7 +10,7 @@ module Qiniu
10
10
 
11
11
  include Utils
12
12
 
13
- attr_accessor :scope, :expires_in, :callback_url, :callback_body_type, :customer, :escape
13
+ attr_accessor :scope, :expires_in, :callback_url, :callback_body_type, :customer, :escape, :async_options
14
14
 
15
15
  def initialize(opts = {})
16
16
  @scope = opts[:scope]
@@ -19,6 +19,7 @@ module Qiniu
19
19
  @callback_body_type = opts[:callback_body_type]
20
20
  @customer = opts[:customer]
21
21
  @escape = opts[:escape]
22
+ @async_options = opts[:async_options]
22
23
  end
23
24
 
24
25
  def generate_signature
@@ -27,6 +28,7 @@ module Qiniu
27
28
  params[:callbackBodyType] = @callback_body_type if !@callback_body_type.nil? && !@callback_body_type.empty?
28
29
  params[:customer] = @customer if !@customer.nil? && !@customer.empty?
29
30
  params[:escape] = 1 if @escape == 1 || @escape == true
31
+ params[:asyncOps] = @async_options if !@async_options.nil? && !@async_options.empty?
30
32
  Utils.urlsafe_base64_encode(params.to_json)
31
33
  end
32
34
 
@@ -20,7 +20,12 @@ module Qiniu
20
20
 
21
21
  local_file = File.expand_path('../' + @key, __FILE__)
22
22
 
23
- upopts = {:scope => @bucket, :expires_in => 3600, :customer => "why404@gmail.com"}
23
+ upopts = {
24
+ :scope => @bucket,
25
+ :expires_in => 3600,
26
+ :customer => "why404@gmail.com",
27
+ :async_options => "imageView/1/w/120/h/120"
28
+ }
24
29
  uptoken = Qiniu::RS.generate_upload_token(upopts)
25
30
  data = Qiniu::RS.upload_file :uptoken => uptoken, :file => local_file, :bucket => @bucket, :key => @key
26
31
  puts data.inspect
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qiniu-rs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-09 00:00:00.000000000 Z
12
+ date: 2013-01-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -188,7 +188,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
188
  version: '0'
189
189
  segments:
190
190
  - 0
191
- hash: -3190608714994781075
191
+ hash: -607371140838855446
192
192
  required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  version: '0'
198
198
  segments:
199
199
  - 0
200
- hash: -3190608714994781075
200
+ hash: -607371140838855446
201
201
  requirements: []
202
202
  rubyforge_project:
203
203
  rubygems_version: 1.8.24