tp_common 0.4.8 → 0.4.9

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: 9a9d7e389d98a73c79116fb8d9f848ce7cb313703f8e6954879d21553b69b601
4
- data.tar.gz: 738b0a1d3558d09de2daa97b8f1f7b3d8402169e8c7efbe8104d6f9b5fb27513
3
+ metadata.gz: 76ae52e0baab21ed839ede8ee196fed6e0a123c13c1bca569cff78b8d31b8869
4
+ data.tar.gz: 880765f4844ee16f189c06c4115d1aff604db03edf532d4ad2c9ee689ce95020
5
5
  SHA512:
6
- metadata.gz: 860407f0fadeb860b1bfb13c2bd53239b1a9d389faf989c015b947661b48c57c6b630024d906d52fd77ffac23be73ebe1af2e4cca2e1b45b27debd60f594806a
7
- data.tar.gz: 1a03f06477d9a41bc8808ec4e0c1d438a32dafa0dbfdc0bae6ac7740715954d6033e67f10eb36de4338164e55d49753814844fde98252921466f16be82a3b1b0
6
+ metadata.gz: 164b26f461f1a09efaf48288f66b5355acba3513016c8964d5edba7aa840164f86724a3c49dbaaf3a8f3e41c5f2e60eb643ed16e2cb6a8300c307541412efcb3
7
+ data.tar.gz: 1c0d1b78699356f67318cb686ef0ddd6411d0ff5b92eaf61d177508d2469c873bfcff8315c8afd6f053f4733d0d4e129c75669114b90b925dfa36cd258dfd3d1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- tp_common (0.4.8)
4
+ tp_common (0.4.9)
5
5
  activesupport (>= 4.2.0, < 7.0)
6
6
  aws-sdk-s3 (~> 1.19)
7
7
  fog-aws (~> 2.0)
@@ -53,8 +53,8 @@ GEM
53
53
  thor (>= 0.14.0)
54
54
  arel (6.0.4)
55
55
  aws-eventstream (1.0.3)
56
- aws-partitions (1.281.0)
57
- aws-sdk-core (3.91.0)
56
+ aws-partitions (1.286.0)
57
+ aws-sdk-core (3.92.0)
58
58
  aws-eventstream (~> 1.0, >= 1.0.2)
59
59
  aws-partitions (~> 1, >= 1.239.0)
60
60
  aws-sigv4 (~> 1.1)
@@ -62,7 +62,7 @@ GEM
62
62
  aws-sdk-kms (1.30.0)
63
63
  aws-sdk-core (~> 3, >= 3.71.0)
64
64
  aws-sigv4 (~> 1.1)
65
- aws-sdk-s3 (1.61.0)
65
+ aws-sdk-s3 (1.61.1)
66
66
  aws-sdk-core (~> 3, >= 3.83.0)
67
67
  aws-sdk-kms (~> 1)
68
68
  aws-sigv4 (~> 1.1)
@@ -77,7 +77,7 @@ GEM
77
77
  crass (1.0.4)
78
78
  diff-lcs (1.3)
79
79
  erubis (2.7.0)
80
- excon (0.72.0)
80
+ excon (0.73.0)
81
81
  fog-aws (2.0.1)
82
82
  fog-core (~> 1.38)
83
83
  fog-json (~> 1.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- tp_common (0.4.8)
4
+ tp_common (0.4.9)
5
5
  activesupport (>= 4.2.0, < 7.0)
6
6
  aws-sdk-s3 (~> 1.19)
7
7
  fog-aws (~> 2.0)
@@ -60,8 +60,8 @@ GEM
60
60
  thor (>= 0.14.0)
61
61
  arel (9.0.0)
62
62
  aws-eventstream (1.0.3)
63
- aws-partitions (1.281.0)
64
- aws-sdk-core (3.91.0)
63
+ aws-partitions (1.286.0)
64
+ aws-sdk-core (3.92.0)
65
65
  aws-eventstream (~> 1.0, >= 1.0.2)
66
66
  aws-partitions (~> 1, >= 1.239.0)
67
67
  aws-sigv4 (~> 1.1)
@@ -69,7 +69,7 @@ GEM
69
69
  aws-sdk-kms (1.30.0)
70
70
  aws-sdk-core (~> 3, >= 3.71.0)
71
71
  aws-sigv4 (~> 1.1)
72
- aws-sdk-s3 (1.61.0)
72
+ aws-sdk-s3 (1.61.1)
73
73
  aws-sdk-core (~> 3, >= 3.83.0)
74
74
  aws-sdk-kms (~> 1)
75
75
  aws-sigv4 (~> 1.1)
@@ -84,7 +84,7 @@ GEM
84
84
  crass (1.0.4)
85
85
  diff-lcs (1.3)
86
86
  erubi (1.8.0)
87
- excon (0.72.0)
87
+ excon (0.73.0)
88
88
  fog-aws (2.0.1)
89
89
  fog-core (~> 1.38)
90
90
  fog-json (~> 1.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- tp_common (0.4.8)
4
+ tp_common (0.4.9)
5
5
  activesupport (>= 4.2.0, < 7.0)
6
6
  aws-sdk-s3 (~> 1.19)
7
7
  fog-aws (~> 2.0)
@@ -73,8 +73,8 @@ GEM
73
73
  rake
74
74
  thor (>= 0.14.0)
75
75
  aws-eventstream (1.0.3)
76
- aws-partitions (1.281.0)
77
- aws-sdk-core (3.91.0)
76
+ aws-partitions (1.286.0)
77
+ aws-sdk-core (3.92.0)
78
78
  aws-eventstream (~> 1.0, >= 1.0.2)
79
79
  aws-partitions (~> 1, >= 1.239.0)
80
80
  aws-sigv4 (~> 1.1)
@@ -82,7 +82,7 @@ GEM
82
82
  aws-sdk-kms (1.30.0)
83
83
  aws-sdk-core (~> 3, >= 3.71.0)
84
84
  aws-sigv4 (~> 1.1)
85
- aws-sdk-s3 (1.61.0)
85
+ aws-sdk-s3 (1.61.1)
86
86
  aws-sdk-core (~> 3, >= 3.83.0)
87
87
  aws-sdk-kms (~> 1)
88
88
  aws-sigv4 (~> 1.1)
@@ -97,7 +97,7 @@ GEM
97
97
  crass (1.0.4)
98
98
  diff-lcs (1.3)
99
99
  erubi (1.8.0)
100
- excon (0.72.0)
100
+ excon (0.73.0)
101
101
  fog-aws (2.0.1)
102
102
  fog-core (~> 1.38)
103
103
  fog-json (~> 1.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- tp_common (0.4.8)
4
+ tp_common (0.4.9)
5
5
  activesupport (>= 4.2.0, < 7.0)
6
6
  aws-sdk-s3 (~> 1.19)
7
7
  fog-aws (~> 2.0)
@@ -73,8 +73,8 @@ GEM
73
73
  rake
74
74
  thor (>= 0.14.0)
75
75
  aws-eventstream (1.0.3)
76
- aws-partitions (1.281.0)
77
- aws-sdk-core (3.91.0)
76
+ aws-partitions (1.286.0)
77
+ aws-sdk-core (3.92.0)
78
78
  aws-eventstream (~> 1.0, >= 1.0.2)
79
79
  aws-partitions (~> 1, >= 1.239.0)
80
80
  aws-sigv4 (~> 1.1)
@@ -82,7 +82,7 @@ GEM
82
82
  aws-sdk-kms (1.30.0)
83
83
  aws-sdk-core (~> 3, >= 3.71.0)
84
84
  aws-sigv4 (~> 1.1)
85
- aws-sdk-s3 (1.61.0)
85
+ aws-sdk-s3 (1.61.1)
86
86
  aws-sdk-core (~> 3, >= 3.83.0)
87
87
  aws-sdk-kms (~> 1)
88
88
  aws-sigv4 (~> 1.1)
@@ -97,7 +97,7 @@ GEM
97
97
  crass (1.0.4)
98
98
  diff-lcs (1.3)
99
99
  erubi (1.8.0)
100
- excon (0.72.0)
100
+ excon (0.73.0)
101
101
  fog-aws (2.0.1)
102
102
  fog-core (~> 1.38)
103
103
  fog-json (~> 1.0)
@@ -7,7 +7,7 @@ module TpCommon
7
7
  class Private < FileStorage::Base
8
8
  # Pull a file with provided key.
9
9
  # Return a Fog file object https://www.rubydoc.info/github/fog/fog-aws/Fog/Storage/AWS/File
10
- #
10
+ # @param file_key [String]
11
11
  def download(file_key)
12
12
  retried_count = 0
13
13
  begin
@@ -22,9 +22,15 @@ module TpCommon
22
22
  end
23
23
 
24
24
  # Same as #download but return file content
25
+ # @param file_key [String]
25
26
  def read(file_key)
26
27
  download(mask_key(file_key)).body
27
28
  end
29
+
30
+ # @param file_key [String]
31
+ def exists?(file_key)
32
+ !!directory.files.head(mask_key(file_key))
33
+ end
28
34
  end
29
35
  end
30
36
  end
@@ -26,6 +26,7 @@ module TpCommon
26
26
 
27
27
  mask_key(file_key)
28
28
  end
29
+
29
30
  # Get url from key of file #upload above to provide to outside.
30
31
  # To get file content to use inside system, please use Downloaders::Private instead
31
32
  # As private file, link has a ttl, default 1 week.
@@ -33,6 +34,11 @@ module TpCommon
33
34
  def url(file_key, link_ttl = 1.week.from_now)
34
35
  directory.files.get_https_url(mask_key(file_key), link_ttl)
35
36
  end
37
+
38
+ # @param file_key [String]
39
+ def exists?(file_key)
40
+ !!directory.files.head(mask_key(file_key))
41
+ end
36
42
  end
37
43
  end
38
44
  end
@@ -30,6 +30,11 @@ module TpCommon
30
30
  def url(file_key)
31
31
  directory.files.get(mask_key(file_key))&.public_url
32
32
  end
33
+
34
+ # @param file_key [String]
35
+ def exists?(file_key)
36
+ !!directory.files.head(mask_key(file_key))
37
+ end
33
38
  end
34
39
  end
35
40
  end
@@ -1,3 +1,3 @@
1
1
  module TpCommon
2
- VERSION = "0.4.8"
2
+ VERSION = "0.4.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tp_common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - TINYpulse Devops
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-13 00:00:00.000000000 Z
11
+ date: 2020-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler