teak_util 0.1.1 → 0.1.3

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: d2430a7886e8120a736af405b4365222cb623f2a500d2e7fc6cd6fd954bc02de
4
- data.tar.gz: 4b866e13745f013bc2b2bd30dc2109fa2e3c995fd0f62f889aa652c42ba91ad2
3
+ metadata.gz: 3e584658dc728de14032e9a66300a243cf9575faaf939da8a52ad8e4fb5fc557
4
+ data.tar.gz: ddd8a0b2fa4ed323c86240257c082a28315f534c92f16f57fd26c915d5d57708
5
5
  SHA512:
6
- metadata.gz: f873faf295b30ab22b682b4e2d92413b9d4b504670e4c614a0dba960e29d849cc7f34336cf08d77b69846d3bd6c0be9ba4ce9397fa0d60587abbe561e0e65578
7
- data.tar.gz: 47c3c1629dd4341b23163b64f57f6ee0d3c9bb926f4ea60601a428c1d951c67876a2aca6cb06c08fa43f26322999c4307a199eb444569a402c56abba316469af
6
+ metadata.gz: 5397427c278a604b2d4326050c673a0f03c9b8f0a2b52379288862ae5d8b75aa396bb9dc9aea83fde2a75a2379518049afd04df9d8cc3b62b027a04b3b7086c5
7
+ data.tar.gz: 33150a644a227207e1c5db8308c64fd0e7acf2c7275a64baf3dce750d79a1b120249ee5bec9339af350e6aa24480b5e0288d5c4a6db046b15a37cd27eb817d1e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 0.1.3
2
+
3
+ ENHANCEMENTS:
4
+
5
+ * Added Storage::S3#bucket_name to read back configured bucket name.
6
+
7
+ ## 0.1.2
8
+
9
+ ENHANCEMENTS:
10
+
11
+ * Added Storage::S3#del to delete objects from S3.
12
+
1
13
  ## 0.1.1
2
14
 
3
15
  ENHANCEMENTS:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- teak_util (0.1.1)
4
+ teak_util (0.1.3)
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.1)
14
- activesupport (= 7.1.1)
15
- activesupport (7.1.1)
13
+ activemodel (7.1.3.2)
14
+ activesupport (= 7.1.3.2)
15
+ activesupport (7.1.3.2)
16
16
  base64
17
17
  bigdecimal
18
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -22,41 +22,40 @@ GEM
22
22
  minitest (>= 5.1)
23
23
  mutex_m
24
24
  tzinfo (~> 2.0)
25
- aws-eventstream (1.2.0)
26
- aws-partitions (1.834.0)
27
- aws-sdk-core (3.185.1)
28
- aws-eventstream (~> 1, >= 1.0.2)
25
+ aws-eventstream (1.3.0)
26
+ aws-partitions (1.925.0)
27
+ aws-sdk-core (3.194.2)
28
+ aws-eventstream (~> 1, >= 1.3.0)
29
29
  aws-partitions (~> 1, >= 1.651.0)
30
- aws-sigv4 (~> 1.5)
30
+ aws-sigv4 (~> 1.8)
31
31
  jmespath (~> 1, >= 1.6.1)
32
- aws-sdk-kms (1.72.0)
33
- aws-sdk-core (~> 3, >= 3.184.0)
32
+ aws-sdk-kms (1.80.0)
33
+ aws-sdk-core (~> 3, >= 3.193.0)
34
34
  aws-sigv4 (~> 1.1)
35
- aws-sdk-s3 (1.136.0)
36
- aws-sdk-core (~> 3, >= 3.181.0)
35
+ aws-sdk-s3 (1.149.1)
36
+ aws-sdk-core (~> 3, >= 3.194.0)
37
37
  aws-sdk-kms (~> 1)
38
- aws-sigv4 (~> 1.6)
39
- aws-sigv4 (1.6.0)
38
+ aws-sigv4 (~> 1.8)
39
+ aws-sigv4 (1.8.0)
40
40
  aws-eventstream (~> 1, >= 1.0.2)
41
- base64 (0.1.1)
42
- bigdecimal (3.1.4)
43
- business_flow (0.19.3)
41
+ base64 (0.2.0)
42
+ bigdecimal (3.1.8)
43
+ business_flow (0.19.4)
44
44
  activemodel (>= 4.2, < 8)
45
45
  activesupport (>= 4.2, < 8)
46
- concurrent-ruby (1.2.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.1.1)
51
- ruby2_keywords
52
- i18n (1.14.1)
50
+ drb (2.2.1)
51
+ i18n (1.14.5)
53
52
  concurrent-ruby (~> 1.0)
54
53
  jmespath (1.6.2)
55
- mime-types (3.5.1)
54
+ mime-types (3.5.2)
56
55
  mime-types-data (~> 3.2015)
57
- mime-types-data (3.2023.1003)
58
- minitest (5.20.0)
59
- mutex_m (0.1.2)
56
+ mime-types-data (3.2024.0507)
57
+ minitest (5.22.3)
58
+ mutex_m (0.2.0)
60
59
  rake (13.0.6)
61
60
  rspec (3.12.0)
62
61
  rspec-core (~> 3.12.0)
@@ -71,7 +70,6 @@ GEM
71
70
  diff-lcs (>= 1.2.0, < 2.0)
72
71
  rspec-support (~> 3.12.0)
73
72
  rspec-support (3.12.1)
74
- ruby2_keywords (0.0.5)
75
73
  rubyzip (2.3.2)
76
74
  simplecov (0.22.0)
77
75
  docile (~> 1.1)
@@ -38,7 +38,7 @@ 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 = "#{@prefix}#{key}"
41
+ path = prefixed_path(key)
42
42
  @bucket.object(path).put(
43
43
  opts.merge(@put_opts.merge(body: value))
44
44
  )
@@ -48,14 +48,19 @@ module TeakUtil
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(path).get.body.read
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,17 @@ 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
+ # Returns the name of the bucket.
73
+ def bucket_name
74
+ @bucket.name
75
+ end
76
+
77
+ private
78
+
79
+ def prefixed_path(key)
80
+ "#{@prefix}#{key}"
81
+ end
66
82
  end
67
83
  end
68
84
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TeakUtil
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.3"
5
5
  end
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.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Scarborough
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-15 00:00:00.000000000 Z
11
+ date: 2024-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3