Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip-qiniu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip-qiniu
Commits
a6c4796e
Commit
a6c4796e
authored
Aug 26, 2012
by
LI Daobing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use qiniu-rs v3
parent
354d9341
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
5 deletions
+15
-5
Gemfile.lock
+1
-1
lib/paperclip-qiniu/exceptions.rb
+6
-0
lib/paperclip/storage/qiniu.rb
+7
-3
paperclip-qiniu.gemspec
+1
-1
No files found.
Gemfile.lock
View file @
a6c4796e
...
...
@@ -3,7 +3,7 @@ PATH
specs:
paperclip-qiniu (0.0.2)
paperclip
qiniu-rs
qiniu-rs
(~> 3.0)
GEM
remote: https://rubygems.org/
...
...
lib/paperclip-qiniu/exceptions.rb
0 → 100644
View file @
a6c4796e
module
Paperclip
module
Qiniu
class
Error
<
StandardError
;
end
class
UploadFailed
<
Error
;
end
end
end
lib/paperclip/storage/qiniu.rb
View file @
a6c4796e
require
'paperclip-qiniu/exceptions'
module
Paperclip
module
Storage
module
Qiniu
...
...
@@ -74,14 +76,16 @@ module Paperclip
end
def
upload
(
file
,
path
)
remote_upload_url
=
::
Qiniu
::
RS
.
put_auth
opts
=
{
:u
rl
=>
remote_upload_url
,
upload_token
=
::
Qiniu
::
RS
.
generate_upload_token
:scope
=>
bucket
opts
=
{
:u
ptoken
=>
upload_token
,
:file
=>
file
.
path
,
:key
=>
path
,
:bucket
=>
bucket
,
:mime_type
=>
file
.
content_type
,
:enable_crc32_check
=>
true
}
::
Qiniu
::
RS
.
upload
opts
unless
::
Qiniu
::
RS
.
upload_file
(
opts
)
raise
Paperclip
::
Qiniu
::
UploadFailed
end
end
def
bucket
...
...
paperclip-qiniu.gemspec
View file @
a6c4796e
...
...
@@ -15,6 +15,6 @@ Gem::Specification.new do |gem|
gem
.
require_paths
=
[
"lib"
]
gem
.
version
=
Paperclip
::
Qiniu
::
VERSION
gem
.
add_dependency
'
paperclip
'
gem
.
add_dependency
'
qiniu-rs
'
gem
.
add_dependency
'
qiniu-rs
'
,
'~> 3.0'
gem
.
add_development_dependency
'
rspec
'
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment