carrierwave-upyun 0.2.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 55e609d0b0ef057e2fd07f28447fe63c4e6f8dce
4
- data.tar.gz: 6661c00af66616dfbd560059b8008f9a8dd3ef7e
2
+ SHA256:
3
+ metadata.gz: 6915aa09ab9b7059d576c1dc6162cfaefd60ba5c48bcb4361724f321b43ebe93
4
+ data.tar.gz: 03af17a59f9c9aa13a742565c4e20c8c1c1c7a1df7726736c99047e21c8e2ca4
5
5
  SHA512:
6
- metadata.gz: 1766433175d28dae3b9c5050d8d29a362d4339b29d4b0344daa2326cd0515a787d69f9de13027a56665230487f515e0439e6303e0aed50076ff0b472b43f0e8f
7
- data.tar.gz: 792513795c24d0ac738614336065a003dc13a35af912b4d8f6a85710dd3ca864114e2918995a758bd186f1600a8e202d0d00702c00ad4f75f908d1cc5d835c0b
6
+ metadata.gz: 6888113e3efb214f774fa9f28df17c16465c5b66aded6d35949b4fc5435a211c8a9129ebd4349bc4a6fb32d9ca23ca59711906810e485d3d49a096f97e3273b1
7
+ data.tar.gz: 357b98e4ff157f305d60843bbaa54d88bd7f1f19b66885ee127c724de44254b6ad1ce444dddc98ee7c230a5789a9546fbfadc1bd07e60cee6b374f27961321a2
data/README.md CHANGED
@@ -16,7 +16,7 @@ gem 'carrierwave-upyun'
16
16
 
17
17
  ## Configuration
18
18
 
19
- You'll need to configure the to use this in config/initializes/carrierwave.rb
19
+ You'll need to configure the to use this in config/initializers/carrierwave.rb
20
20
 
21
21
  ```ruby
22
22
  CarrierWave.configure do |config|
@@ -16,7 +16,7 @@ module CarrierWave
16
16
  #
17
17
  class UpYun < Abstract
18
18
  DEFAULT_API_URL = 'http://v0.api.upyun.com'
19
-
19
+
20
20
  class File < CarrierWave::SanitizedFile
21
21
  def initialize(uploader, base, path)
22
22
  @uploader = uploader
@@ -34,7 +34,7 @@ module CarrierWave
34
34
  def path
35
35
  @path
36
36
  end
37
-
37
+
38
38
  def escaped_path
39
39
  @escaped_path ||= CGI.escape(@path)
40
40
  end
@@ -102,9 +102,14 @@ module CarrierWave
102
102
  # boolean
103
103
  #
104
104
  def store(data, headers = {})
105
- conn.put(escaped_path, data) do |req|
105
+ res = conn.put(escaped_path, data) do |req|
106
106
  req.headers = {'Expect' => '', 'Mkdir' => 'true'}.merge(headers)
107
107
  end
108
+ if res.status != 200
109
+ puts "Update failed: #{res.body}"
110
+ return false
111
+ end
112
+
108
113
  true
109
114
  end
110
115
 
@@ -115,10 +120,10 @@ module CarrierWave
115
120
  {}
116
121
  end
117
122
  end
118
-
123
+
119
124
  def conn
120
125
  return @conn if defined?(@conn)
121
-
126
+
122
127
  api_host = @uploader.upyun_api_host || DEFAULT_API_URL
123
128
  @conn = Faraday.new(url: "#{api_host}/#{@uploader.upyun_bucket}") do |req|
124
129
  req.request :basic_auth, @uploader.upyun_username, @uploader.upyun_password
@@ -159,6 +164,21 @@ module CarrierWave
159
164
  File.new(uploader, self, uploader.store_path(identifier))
160
165
  end
161
166
 
167
+ def cache!(file)
168
+ f = File.new(uploader, self, uploader.store_path)
169
+ f.store(file.read, 'Content-Type' => file.content_type)
170
+ f
171
+ end
172
+
173
+ def retrieve_from_cache!(identifier)
174
+ File.new(uploader, self, uploader.cache_path(identifier))
175
+ end
176
+
177
+ def delete_dir!(path)
178
+ end
179
+
180
+ def clean_cache!(seconds)
181
+ end
162
182
  end # CloudFiles
163
183
  end # Storage
164
184
  end # CarrierWave
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave-upyun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nowa Zhu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-04 00:00:00.000000000 Z
12
+ date: 2019-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: carrierwave
@@ -17,14 +17,20 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 0.5.7
20
+ version: 1.0.0
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '2.1'
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
28
  - - ">="
26
29
  - !ruby/object:Gem::Version
27
- version: 0.5.7
30
+ version: 1.0.0
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.1'
28
34
  - !ruby/object:Gem::Dependency
29
35
  name: faraday
30
36
  requirement: !ruby/object:Gem::Requirement
@@ -140,8 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
146
  - !ruby/object:Gem::Version
141
147
  version: '0'
142
148
  requirements: []
143
- rubyforge_project:
144
- rubygems_version: 2.5.2
149
+ rubygems_version: 3.0.3
145
150
  signing_key:
146
151
  specification_version: 4
147
152
  summary: UpYun Storage support for CarrierWave