istox 0.1.156.5 → 0.1.157
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +21 -15
- data/istox.gemspec +1 -0
- data/lib/istox.rb +1 -0
- data/lib/istox/helpers/sns_publisher.rb +38 -0
- data/lib/istox/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f51fbf74138fecbca4e019e075b3c6331cf78d20a5b274c8222c333430e66f68
|
4
|
+
data.tar.gz: 68a475a848f0118566ec6ea8bb8369ffb80ad90781441fc01d357bcd49f7ed78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07becada18723f399368b68194ec4ae9e5f42184fb33296f3358034920e41859865024a1926a51acbde84eb0f2897c5c40d60e5180ed78c7a65b0d54aed8947b
|
7
|
+
data.tar.gz: f9b7aff484d33556e91311e31a0c9a6d4e1166105d80335e6923e9b89511e8fb2873180598ca4e6e06b2e3b871bb43aafcf2c130b2a1d02739be6987b811f307
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
istox (0.1.
|
4
|
+
istox (0.1.157)
|
5
5
|
amazing_print
|
6
6
|
awesome_print
|
7
|
+
aws-sdk-sns (~> 1)
|
7
8
|
binding_of_caller
|
8
9
|
bunny (>= 2.12.0)
|
9
10
|
exponential-backoff (= 0.0.4)
|
@@ -63,8 +64,8 @@ GEM
|
|
63
64
|
i18n (>= 0.7, < 2)
|
64
65
|
minitest (~> 5.1)
|
65
66
|
tzinfo (~> 1.1)
|
66
|
-
amazing_print (1.2.
|
67
|
-
amq-protocol (2.3.
|
67
|
+
amazing_print (1.2.1)
|
68
|
+
amq-protocol (2.3.2)
|
68
69
|
arel (9.0.0)
|
69
70
|
awesome_print (1.8.0)
|
70
71
|
aws-eventstream (1.1.0)
|
@@ -74,6 +75,9 @@ GEM
|
|
74
75
|
aws-partitions (~> 1, >= 1.239.0)
|
75
76
|
aws-sigv4 (~> 1.1)
|
76
77
|
jmespath (~> 1.0)
|
78
|
+
aws-sdk-sns (1.24.0)
|
79
|
+
aws-sdk-core (~> 3, >= 3.71.0)
|
80
|
+
aws-sigv4 (~> 1.1)
|
77
81
|
aws-sdk-xray (1.4.0)
|
78
82
|
aws-sdk-core (~> 3)
|
79
83
|
aws-sigv4 (~> 1.0)
|
@@ -82,13 +86,14 @@ GEM
|
|
82
86
|
aws-xray-sdk (0.11.4)
|
83
87
|
aws-sdk-xray (~> 1.4.0)
|
84
88
|
multi_json (~> 1)
|
89
|
+
bigdecimal (2.0.0)
|
85
90
|
binding_of_caller (0.8.0)
|
86
91
|
debug_inspector (>= 0.0.1)
|
87
92
|
builder (3.2.4)
|
88
93
|
bullet (5.7.6)
|
89
94
|
activesupport (>= 3.0.0)
|
90
95
|
uniform_notifier (~> 1.11.0)
|
91
|
-
bunny (2.
|
96
|
+
bunny (2.16.1)
|
92
97
|
amq-protocol (~> 2.3, >= 2.3.1)
|
93
98
|
byebug (11.1.3)
|
94
99
|
coderay (1.1.2)
|
@@ -115,21 +120,21 @@ GEM
|
|
115
120
|
ffi (1.13.1)
|
116
121
|
globalid (0.4.2)
|
117
122
|
activesupport (>= 4.2.0)
|
118
|
-
google-protobuf (3.
|
123
|
+
google-protobuf (3.13.0-universal-darwin)
|
119
124
|
googleapis-common-protos-types (1.0.5)
|
120
125
|
google-protobuf (~> 3.11)
|
121
126
|
graphlient (0.4.0)
|
122
127
|
faraday (>= 1.0)
|
123
128
|
faraday_middleware
|
124
129
|
graphql-client
|
125
|
-
graphql (1.
|
130
|
+
graphql (1.11.3)
|
126
131
|
graphql-client (0.16.0)
|
127
132
|
activesupport (>= 3.0)
|
128
133
|
graphql (~> 1.8)
|
129
|
-
grpc (1.
|
130
|
-
google-protobuf (~> 3.
|
134
|
+
grpc (1.31.1-universal-darwin)
|
135
|
+
google-protobuf (~> 3.12)
|
131
136
|
googleapis-common-protos-types (~> 1.0)
|
132
|
-
grpc-tools (1.
|
137
|
+
grpc-tools (1.31.1)
|
133
138
|
gruf (2.8.1)
|
134
139
|
activesupport (> 4)
|
135
140
|
concurrent-ruby (> 1)
|
@@ -166,7 +171,8 @@ GEM
|
|
166
171
|
nio4r (2.3.1)
|
167
172
|
nokogiri (1.10.9)
|
168
173
|
mini_portile2 (~> 2.4.0)
|
169
|
-
oj (3.10.
|
174
|
+
oj (3.10.9)
|
175
|
+
bigdecimal (~> 2.0)
|
170
176
|
ougai (1.8.5)
|
171
177
|
oj (~> 3.10)
|
172
178
|
paranoia (2.4.2)
|
@@ -218,16 +224,16 @@ GEM
|
|
218
224
|
redis-activesupport (5.2.0)
|
219
225
|
activesupport (>= 3, < 7)
|
220
226
|
redis-store (>= 1.3, < 2)
|
221
|
-
redis-namespace (1.
|
227
|
+
redis-namespace (1.8.0)
|
222
228
|
redis (>= 3.0.4)
|
223
|
-
redis-rack (2.1.
|
229
|
+
redis-rack (2.1.3)
|
224
230
|
rack (>= 2.0.8, < 3)
|
225
231
|
redis-store (>= 1.2, < 2)
|
226
232
|
redis-rails (5.0.2)
|
227
233
|
redis-actionpack (>= 5.0, < 6)
|
228
234
|
redis-activesupport (>= 5.0, < 6)
|
229
235
|
redis-store (>= 1.2, < 2)
|
230
|
-
redis-store (1.
|
236
|
+
redis-store (1.9.0)
|
231
237
|
redis (>= 4, < 5)
|
232
238
|
rspec (3.8.0)
|
233
239
|
rspec-core (~> 3.8.0)
|
@@ -250,7 +256,7 @@ GEM
|
|
250
256
|
rspec-mocks (~> 3.8.0)
|
251
257
|
rspec-support (~> 3.8.0)
|
252
258
|
rspec-support (3.8.0)
|
253
|
-
slop (4.8.
|
259
|
+
slop (4.8.2)
|
254
260
|
sprockets (3.7.2)
|
255
261
|
concurrent-ruby (~> 1.0)
|
256
262
|
rack (> 1, < 3)
|
@@ -265,7 +271,7 @@ GEM
|
|
265
271
|
tzinfo (1.2.6)
|
266
272
|
thread_safe (~> 0.1)
|
267
273
|
uniform_notifier (1.11.0)
|
268
|
-
vault (0.
|
274
|
+
vault (0.15.0)
|
269
275
|
aws-sigv4
|
270
276
|
websocket-driver (0.7.0)
|
271
277
|
websocket-extensions (>= 0.1.0)
|
data/istox.gemspec
CHANGED
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
|
33
33
|
spec.add_dependency 'amazing_print'
|
34
34
|
spec.add_dependency 'awesome_print'
|
35
|
+
spec.add_dependency 'aws-sdk-sns', '~> 1'
|
35
36
|
spec.add_dependency 'binding_of_caller'
|
36
37
|
spec.add_dependency 'bunny', '>= 2.12.0'
|
37
38
|
spec.add_dependency 'exponential-backoff', '0.0.4'
|
data/lib/istox.rb
CHANGED
@@ -16,6 +16,7 @@ module Istox
|
|
16
16
|
require 'istox/helpers/logger'
|
17
17
|
require 'istox/interfaces/chainhub/transaction'
|
18
18
|
require 'istox/helpers/publisher'
|
19
|
+
require 'istox/helpers/sns_publisher'
|
19
20
|
require 'istox/helpers/subscriber'
|
20
21
|
require 'istox/helpers/bunny_boot'
|
21
22
|
require 'istox/helpers/rate_limit'
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'aws-sdk-sns'
|
2
|
+
|
3
|
+
module Istox
|
4
|
+
class SnsPublisher
|
5
|
+
class << self
|
6
|
+
# exception will not be thrown if throw_exception is set to false, exception will only be printed out and swallowed
|
7
|
+
def publish(message, topic_arn: nil, throw_exception: false)
|
8
|
+
if message.nil?
|
9
|
+
log.info('No message to publish, skipping SNS publish now...')
|
10
|
+
return
|
11
|
+
end
|
12
|
+
|
13
|
+
log.info('Publishing to SNS...')
|
14
|
+
|
15
|
+
message = JSON.generate(message) unless message.is_a? String
|
16
|
+
|
17
|
+
sns_client.publish({ topic_arn: topic_arn || ENV.fetch('PUSHER_TOPIC_ARN', ''), message: message })
|
18
|
+
|
19
|
+
log.info('Publish to SNS successfully.')
|
20
|
+
rescue StandardError => e
|
21
|
+
log.fatal 'Unable to publish SNS message.'
|
22
|
+
log.fatal(e)
|
23
|
+
log.info('Failed to publish SNS, ignoring...') unless throw_exception
|
24
|
+
|
25
|
+
raise e if throw_exception
|
26
|
+
end
|
27
|
+
|
28
|
+
def sns_client
|
29
|
+
return @sns_client if @sns_client.present?
|
30
|
+
|
31
|
+
Aws.config.update({ region: ENV.fetch('AWS_REGION', 'ap-southeast-1'),
|
32
|
+
credentials: Aws::Credentials.new('AWS_STS_ACCESS_KEY_ID', 'AWS_STS_SECRET_ACCESS_KEY') })
|
33
|
+
|
34
|
+
@sns_client = Aws::SNS::Client.new(region: ENV.fetch('AWS_REGION', 'ap-southeast-1'))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/istox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: istox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.157
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Siong Leng
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amazing_print
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: aws-sdk-sns
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: binding_of_caller
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -509,6 +523,7 @@ files:
|
|
509
523
|
- lib/istox/helpers/regex_helper.rb
|
510
524
|
- lib/istox/helpers/remote_model_cache.rb
|
511
525
|
- lib/istox/helpers/result_handler.rb
|
526
|
+
- lib/istox/helpers/sns_publisher.rb
|
512
527
|
- lib/istox/helpers/subscriber.rb
|
513
528
|
- lib/istox/helpers/vault.rb
|
514
529
|
- lib/istox/helpers/xray/grpc_client_xray_interceptor.rb
|