activestorage_upyun 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/lib/active_storage/service/upyun_service.rb +8 -6
- data/lib/activestorage_upyun.rb +0 -2
- data/lib/activestorage_upyun/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed799a10214b73035941a3cd3ce0df53715424118f5f92631f971da783776b14
|
4
|
+
data.tar.gz: 3ed031623b3be001835849dd329db0833fa996f73e110b47a10f55ee85c54372
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca715bd2e7f87244f2e537c4a732cafd0c802cc0cb5690ebab6853956ffefc213ae7600c21e9361b677b6a1f214bcafb7674ef28f0774c414bdfd31e803fd3e5
|
7
|
+
data.tar.gz: b74928ab2c6d61b7b0e6e14150189f4d71fcaa7fb821d1cb9b3e94353b98d59a7d51c19988eaa732f9c1a3bea020beb0f33f432144a974bc64a5f6a3a13c8585
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ Upyun service for activestorage.
|
|
5
5
|
Add this line to your application's Gemfile:
|
6
6
|
|
7
7
|
```ruby
|
8
|
-
gem 'activestorage_upyun'
|
8
|
+
gem 'activestorage_upyun', require: false
|
9
9
|
```
|
10
10
|
|
11
11
|
Set up upyun storage service in config/storage.yml:
|
@@ -13,9 +13,9 @@ Set up upyun storage service in config/storage.yml:
|
|
13
13
|
```yml
|
14
14
|
upyun:
|
15
15
|
service: Upyun
|
16
|
-
bucket: <%= ENV['
|
17
|
-
operator: <%= ENV['
|
18
|
-
password: <%= ENV['
|
16
|
+
bucket: <%= ENV['UPYUN_BUCKET'] %>
|
17
|
+
operator: <%= ENV['UPYUN_OPERATOR'] %>
|
18
|
+
password: <%= ENV['UPYUN_PASSWORD'] %>
|
19
19
|
host: <%= ENV['UPYUN_HOST'] %>
|
20
20
|
folder: <%= ENV['UPYUN_FOLDER'] %>
|
21
21
|
```
|
@@ -43,9 +43,9 @@ thumb version use `!` as default identifier, if you want to use `_` as identifie
|
|
43
43
|
```yml
|
44
44
|
upyun:
|
45
45
|
service: Upyun
|
46
|
-
bucket: <%= ENV['
|
47
|
-
operator: <%= ENV['
|
48
|
-
password: <%= ENV['
|
46
|
+
bucket: <%= ENV['UPYUN_BUCKET'] %>
|
47
|
+
operator: <%= ENV['UPYUN_OPERATOR'] %>
|
48
|
+
password: <%= ENV['UPYUN_PASSWORD'] %>
|
49
49
|
host: <%= ENV['UPYUN_HOST'] %>
|
50
50
|
folder: <%= ENV['UPYUN_FOLDER'] %>
|
51
51
|
identifier: _
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "upyun"
|
2
|
+
|
1
3
|
module ActiveStorage
|
2
4
|
# Wraps the upyun Storage Service as an Active Storage service.
|
3
5
|
# See ActiveStorage::Service for the generic API documentation that applies to all services.
|
@@ -7,9 +9,9 @@ module ActiveStorage
|
|
7
9
|
#
|
8
10
|
# upyun:
|
9
11
|
# service: Upyun
|
10
|
-
# bucket: <%= ENV['
|
11
|
-
# operator: <%= ENV['
|
12
|
-
# password: <%= ENV['
|
12
|
+
# bucket: <%= ENV['UPYUN_BUCKET'] %>
|
13
|
+
# operator: <%= ENV['UPYUN_OPERATOR'] %>
|
14
|
+
# password: <%= ENV['UPYUN_PASSWORD'] %>
|
13
15
|
# host: <%= ENV['UPYUN_HOST'] %>
|
14
16
|
# folder: <%= ENV['UPYUN_FOLDER'] %>
|
15
17
|
#
|
@@ -20,7 +22,7 @@ module ActiveStorage
|
|
20
22
|
#
|
21
23
|
#
|
22
24
|
class Service::UpyunService < Service
|
23
|
-
ENDPOINT = '
|
25
|
+
ENDPOINT = 'https://v0.api.upyun.com'
|
24
26
|
IDENTIFIER = '!'
|
25
27
|
|
26
28
|
attr_reader :upyun, :bucket, :operator, :password, :host, :folder, :upload_options
|
@@ -35,7 +37,7 @@ module ActiveStorage
|
|
35
37
|
@upyun = Upyun::Rest.new(bucket, operator, password, options)
|
36
38
|
end
|
37
39
|
|
38
|
-
def upload(key, io, checksum: nil)
|
40
|
+
def upload(key, io, checksum: nil, content_type: nil, disposition: nil, filename: nil)
|
39
41
|
instrument :upload, key: key, checksum: checksum do
|
40
42
|
begin
|
41
43
|
result = @upyun.put(path_for(key), io)
|
@@ -151,4 +153,4 @@ module ActiveStorage
|
|
151
153
|
Time.now.utc.strftime('%a, %d %b %Y %H:%M:%S GMT')
|
152
154
|
end
|
153
155
|
end
|
154
|
-
end
|
156
|
+
end
|
data/lib/activestorage_upyun.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage_upyun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- doabit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activestorage
|