shrine-google_cloud_storage 1.0.0 → 1.0.1

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
  SHA1:
3
- metadata.gz: 2e36b4d1de28a447a15aab4f23369f8d580d3486
4
- data.tar.gz: 8857d5c06e26ec8c96b4cd0e69672db095eab118
3
+ metadata.gz: d1076839610e614727ac6be9742ee1ec630112f7
4
+ data.tar.gz: 638f6ad6360e4f65ef6db03ca5a0fbd8fa5e6c75
5
5
  SHA512:
6
- metadata.gz: e68c8763ebc015e2c65a8b523b4b56c26115efd9aaad97cd64cea85928abfce73f54a7cc96f8de189c3f70f3bce5b862b304a5ba16d79a6f50525ef02055f1af
7
- data.tar.gz: 0e9322682a9934641d37ecfbff19eb9f69318727e989cb6c33eb7e24b6dc36b111c47cd5ec91a818b7e85a4479d54f6d8a87f20e29a7014052ec8032011fc49d
6
+ metadata.gz: '01968d677153ad556ea301f30149813fee671e094ce1c2744d3fbe9ba59b8f0a85f032d7ce12ef9469c8be8809b36a96ffbb80c51b93dbb7dfe5abf7ea8ca0b2'
7
+ data.tar.gz: '060239c68bea2b0bba944991ec369bd73b32c6c8c87650ba26dc9d31168092a27ace43aa01af2f7a21f445ebecae406572ed859f40d212500c8f9d0917eb8268'
@@ -51,13 +51,10 @@ class Shrine
51
51
 
52
52
  # URL to the remote file, accepts options for customizing the URL
53
53
  def url(id, **options)
54
- if(options.key? :expires)
55
- signed_url = presign(id, options).url
56
- if @host.nil?
57
- signed_url
58
- else
59
- signed_url.gsub(/storage.googleapis.com\/#{@bucket}/, @host)
60
- end
54
+ if options.key? :expires
55
+ signed_url = storage.signed_url(@bucket, object_name(id), options)
56
+ signed_url.gsub!(/storage.googleapis.com\/#{@bucket}/, @host) if @host
57
+ signed_url
61
58
  else
62
59
  host = @host || "storage.googleapis.com/#{@bucket}"
63
60
  "https://#{host}/#{object_name(id)}"
@@ -117,9 +114,15 @@ class Shrine
117
114
  end
118
115
 
119
116
  def presign(id, **options)
117
+ headers = {}
118
+ headers["Content-Type"] = options[:content_type] if options[:content_type]
119
+ headers["Content-MD5"] = options[:content_md5] if options[:content_md5]
120
+ headers.merge!(options[:headers]) if options[:headers]
121
+
120
122
  OpenStruct.new(
121
- url: storage.signed_url(@bucket, object_name(id), options),
123
+ url: storage.signed_url(@bucket, object_name(id), method: "PUT", **options),
122
124
  fields: {},
125
+ headers: headers
123
126
  )
124
127
  end
125
128
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "shrine-google_cloud_storage"
3
- gem.version = "1.0.0"
3
+ gem.version = "1.0.1"
4
4
 
5
5
  gem.required_ruby_version = ">= 2.1"
6
6
 
@@ -19,4 +19,5 @@ Gem::Specification.new do |gem|
19
19
  gem.add_development_dependency "rake"
20
20
  gem.add_development_dependency "minitest"
21
21
  gem.add_development_dependency "dotenv"
22
+ gem.add_development_dependency "http", "~> 3.0"
22
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shrine-google_cloud_storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renaud Chaput
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-29 00:00:00.000000000 Z
11
+ date: 2018-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shrine
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: http
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
83
97
  description:
84
98
  email:
85
99
  - renchap@gmail.com