teak_util 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +23 -23
- data/lib/teak_util/storage/make_externally_available_file.rb +2 -2
- data/lib/teak_util/storage/s3.rb +15 -4
- data/lib/teak_util/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: 92731ed522f798d250b3b9b317c92ba9f17eb3dba21574235fefe7d1938de729
|
4
|
+
data.tar.gz: cad15ef3aa288b56a26574741d6bd22b2fe1377fcd3846656f7d9255ac5ba1d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b6cd53052c02325944ce90f837c085e4fe0bf1ebc5b27c565f4714be5b84308405cec3b0a57fa4e05ad49c4ed9b7f6b803fbf6f96152eebffcc8340b47a625c
|
7
|
+
data.tar.gz: 6cef854be60d4fdc20453e421f158bd4201eaae51c1ae165c392ce76f0171e27f9c81374284ccab7f59263c02db6edcb33dc9e697c588bab4c6f81c15139ea08
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 0.1.2
|
2
|
+
|
3
|
+
ENHANCEMENTS:
|
4
|
+
|
5
|
+
* Added Storage::S3#del to delete objects from S3.
|
6
|
+
|
7
|
+
## 0.1.1
|
8
|
+
|
9
|
+
ENHANCEMENTS:
|
10
|
+
|
11
|
+
* Storage::S3#put now returns the full key the object was stored under
|
12
|
+
* MakeExternallyAvailableFile now provides the full path the object is accessible under.
|
13
|
+
|
1
14
|
## 0.1.0
|
2
15
|
|
3
16
|
Initial release.
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
teak_util (0.1.
|
4
|
+
teak_util (0.1.2)
|
5
5
|
aws-sdk-s3 (>= 1.102)
|
6
6
|
business_flow (>= 0.18.0)
|
7
7
|
mime-types (>= 3)
|
@@ -10,9 +10,9 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activemodel (7.1.
|
14
|
-
activesupport (= 7.1.
|
15
|
-
activesupport (7.1.
|
13
|
+
activemodel (7.1.2)
|
14
|
+
activesupport (= 7.1.2)
|
15
|
+
activesupport (7.1.2)
|
16
16
|
base64
|
17
17
|
bigdecimal
|
18
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
@@ -22,41 +22,41 @@ GEM
|
|
22
22
|
minitest (>= 5.1)
|
23
23
|
mutex_m
|
24
24
|
tzinfo (~> 2.0)
|
25
|
-
aws-eventstream (1.
|
26
|
-
aws-partitions (1.
|
27
|
-
aws-sdk-core (3.
|
28
|
-
aws-eventstream (~> 1, >= 1.0
|
25
|
+
aws-eventstream (1.3.0)
|
26
|
+
aws-partitions (1.880.0)
|
27
|
+
aws-sdk-core (3.190.2)
|
28
|
+
aws-eventstream (~> 1, >= 1.3.0)
|
29
29
|
aws-partitions (~> 1, >= 1.651.0)
|
30
|
-
aws-sigv4 (~> 1.
|
30
|
+
aws-sigv4 (~> 1.8)
|
31
31
|
jmespath (~> 1, >= 1.6.1)
|
32
|
-
aws-sdk-kms (1.
|
33
|
-
aws-sdk-core (~> 3, >= 3.
|
32
|
+
aws-sdk-kms (1.76.0)
|
33
|
+
aws-sdk-core (~> 3, >= 3.188.0)
|
34
34
|
aws-sigv4 (~> 1.1)
|
35
|
-
aws-sdk-s3 (1.
|
36
|
-
aws-sdk-core (~> 3, >= 3.
|
35
|
+
aws-sdk-s3 (1.142.0)
|
36
|
+
aws-sdk-core (~> 3, >= 3.189.0)
|
37
37
|
aws-sdk-kms (~> 1)
|
38
|
-
aws-sigv4 (~> 1.
|
39
|
-
aws-sigv4 (1.
|
38
|
+
aws-sigv4 (~> 1.8)
|
39
|
+
aws-sigv4 (1.8.0)
|
40
40
|
aws-eventstream (~> 1, >= 1.0.2)
|
41
|
-
base64 (0.
|
42
|
-
bigdecimal (3.1.
|
41
|
+
base64 (0.2.0)
|
42
|
+
bigdecimal (3.1.5)
|
43
43
|
business_flow (0.19.3)
|
44
44
|
activemodel (>= 4.2, < 8)
|
45
45
|
activesupport (>= 4.2, < 8)
|
46
|
-
concurrent-ruby (1.2.
|
46
|
+
concurrent-ruby (1.2.3)
|
47
47
|
connection_pool (2.4.1)
|
48
48
|
diff-lcs (1.5.0)
|
49
49
|
docile (1.4.0)
|
50
|
-
drb (2.
|
50
|
+
drb (2.2.0)
|
51
51
|
ruby2_keywords
|
52
52
|
i18n (1.14.1)
|
53
53
|
concurrent-ruby (~> 1.0)
|
54
54
|
jmespath (1.6.2)
|
55
|
-
mime-types (3.5.
|
55
|
+
mime-types (3.5.2)
|
56
56
|
mime-types-data (~> 3.2015)
|
57
|
-
mime-types-data (3.2023.
|
58
|
-
minitest (5.
|
59
|
-
mutex_m (0.
|
57
|
+
mime-types-data (3.2023.1205)
|
58
|
+
minitest (5.21.1)
|
59
|
+
mutex_m (0.2.0)
|
60
60
|
rake (13.0.6)
|
61
61
|
rspec (3.12.0)
|
62
62
|
rspec-core (~> 3.12.0)
|
@@ -21,7 +21,7 @@ module TeakUtil
|
|
21
21
|
lookup :storage, by: [:bucket_name, :prefix], with: -> { Storage::S3.new(bucket_name, prefix: "#{prefix}#{time_prefix}") }
|
22
22
|
uses(:time_prefix) { Time.now.utc.strftime('%Y/%m/%d/') }
|
23
23
|
|
24
|
-
provides :stored_file_name, :public_url
|
24
|
+
provides :stored_file_name, :public_url, :full_path
|
25
25
|
|
26
26
|
step :convert_data
|
27
27
|
step :store_data
|
@@ -70,7 +70,7 @@ module TeakUtil
|
|
70
70
|
content_disposition: "attachment; filename=\"#{stored_file_name}\""
|
71
71
|
}
|
72
72
|
opts[:content_type] = content_type if content_type
|
73
|
-
storage.put(stored_file_name, data, opts)
|
73
|
+
self.full_path = storage.put(stored_file_name, data, opts)
|
74
74
|
|
75
75
|
self.public_url = storage.public_url(stored_file_name)
|
76
76
|
end
|
data/lib/teak_util/storage/s3.rb
CHANGED
@@ -38,24 +38,29 @@ module TeakUtil
|
|
38
38
|
# @option opts [String] :content_type A standard MIME type describing the format of the contents.
|
39
39
|
# @option opts [String] :content_disposition Specifies presentational information for the object.
|
40
40
|
def put(key, value, opts = {})
|
41
|
-
path =
|
41
|
+
path = prefixed_path(key)
|
42
42
|
@bucket.object(path).put(
|
43
43
|
opts.merge(@put_opts.merge(body: value))
|
44
44
|
)
|
45
|
-
|
45
|
+
path
|
46
46
|
end
|
47
47
|
|
48
48
|
# Retrieves the value stored at key
|
49
49
|
# @param key [String]
|
50
50
|
def get(key)
|
51
|
-
path = "#{@prefix}#{key}"
|
52
51
|
begin
|
53
|
-
@bucket.object(
|
52
|
+
@bucket.object(prefixed_path(key)).get.body.read
|
54
53
|
rescue Aws::S3::Errors::NoSuchKey
|
55
54
|
return nil
|
56
55
|
end
|
57
56
|
end
|
58
57
|
|
58
|
+
# Deletes the value stored at key
|
59
|
+
# @param key [String]
|
60
|
+
def del(key)
|
61
|
+
@bucket.object(prefixed_path(key)).delete
|
62
|
+
end
|
63
|
+
|
59
64
|
# Returns a URL which allows public access to the data stored at key
|
60
65
|
# @param expires_in [Fixnum] number of seconds the link will remain valid for
|
61
66
|
# Maximum is 604800 (1 week).
|
@@ -63,6 +68,12 @@ module TeakUtil
|
|
63
68
|
path = "#{@prefix}#{key}"
|
64
69
|
@bucket.object(path).presigned_url(:get, expires_in: expires_in.to_i)
|
65
70
|
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def prefixed_path(key)
|
75
|
+
"#{@prefix}#{key}"
|
76
|
+
end
|
66
77
|
end
|
67
78
|
end
|
68
79
|
end
|
data/lib/teak_util/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teak_util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Scarborough
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|