tp_common 0.4.8 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/gemfiles/rails_4.gemfile.lock +5 -5
- data/gemfiles/rails_5.gemfile.lock +5 -5
- data/gemfiles/rails_6.gemfile.lock +5 -5
- data/gemfiles/rails_latest.gemfile.lock +5 -5
- data/lib/tp_common/file_storage/downloaders/private.rb +7 -1
- data/lib/tp_common/file_storage/uploaders/private.rb +6 -0
- data/lib/tp_common/file_storage/uploaders/public.rb +5 -0
- data/lib/tp_common/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: 76ae52e0baab21ed839ede8ee196fed6e0a123c13c1bca569cff78b8d31b8869
|
|
4
|
+
data.tar.gz: 880765f4844ee16f189c06c4115d1aff604db03edf532d4ad2c9ee689ce95020
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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.
|
|
57
|
-
aws-sdk-core (3.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
64
|
-
aws-sdk-core (3.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
77
|
-
aws-sdk-core (3.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
77
|
-
aws-sdk-core (3.
|
|
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.
|
|
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.
|
|
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
|
data/lib/tp_common/version.rb
CHANGED
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.
|
|
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-
|
|
11
|
+
date: 2020-03-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|