paperclip-backblaze 0.2.5 → 0.2.7

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
2
  SHA256:
3
- metadata.gz: 0e016bc1d98c3e799b7420f2f94746e636fd0c71f2f5e931d67b4935a9f80b90
4
- data.tar.gz: dba696d9f0bc81da19060a62abab8037223a535e6893bf06632473c019fb70c4
3
+ metadata.gz: 861d89314c8715f439e5d3f0e4abd7417c39ad27b2e0c6c29059ec3d4676684b
4
+ data.tar.gz: 2a17a326fef75b150e827726559de91b9bc4ac34b69afe0217ac082faed80251
5
5
  SHA512:
6
- metadata.gz: 698a96e69b802fd5ecd27ca2ed4fc6eaf7b931e691a4213f3dfee1e81af77f07955829018b80384c211bb3aab648959bbb97025f29744d180dcb79743f26e604
7
- data.tar.gz: 637d4d9f0cd6e1fe97a7f4da8166a7085613fea0f170775fba61366bc66c2eba0c180ed6a612d005464501cb70f1e4c0a758284e5b838652d18cd969c53ca22c
6
+ metadata.gz: c039e1398819bda333c1a1ad5ff0075e26df3dbfefa3b5ed74553d5c75a468eed3a28f0e24cdb95e57a31f335abecf54ff4cd1b767649e3e837b2045d4061377
7
+ data.tar.gz: 6db3b9d7a77d07b4b99737ceb776565272dcadac8a2f5f95260e24b63cb5c2d4c24e6c0b6dcb23761ea05389171fe3367ff88c663ec1958018e357a3e8b1afbb
@@ -42,7 +42,6 @@ module Paperclip
42
42
  def self.extended(base)
43
43
  base.instance_eval do
44
44
  @b2_buckets = {}
45
- login
46
45
  unless @options[:url] =~ /\Ab2.*url\z/
47
46
  @options[:url] = ':b2_path_url'.freeze
48
47
  end
@@ -50,11 +49,15 @@ module Paperclip
50
49
 
51
50
  unless Paperclip::Interpolations.respond_to? :b2_path_url
52
51
  Paperclip.interpolates(:b2_path_url) do |attachment, style|
53
- "#{::Backblaze::B2.download_url}/file/#{attachment.b2_bucket_name}/#{attachment.path(style).sub(%r{\A/}, '')}"
52
+ "#{attachment.cdn || ::Backblaze::B2.download_url}/file/#{attachment.b2_bucket_name}/#{attachment.path(style).sub(%r{\A/}, '')}"
54
53
  end
55
54
  end
56
55
  end
57
56
 
57
+ def cdn
58
+ @options[:cdn]
59
+ end
60
+
58
61
  # Reads b2_credentials from the config file
59
62
  # must be a hash
60
63
  # {
@@ -86,6 +89,7 @@ module Paperclip
86
89
 
87
90
  # Return the specified bucket name as a String.
88
91
  def b2_bucket_name
92
+ login
89
93
  @bucket_name ||= @options[:bucket] || b2_credentials.fetch(:bucket)
90
94
  end
91
95
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = 'paperclip-backblaze'
4
- spec.version = '0.2.5'
4
+ spec.version = '0.2.7'
5
5
  spec.authors = ['Alex Tsui', 'Winston Durand']
6
6
  spec.email = ['alextsui05@gmail.com']
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-backblaze
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Tsui
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-01-20 00:00:00.000000000 Z
12
+ date: 2022-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler