istox 0.2.4 → 0.2.5.3.pre.51
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/.gitignore +0 -0
- data/.rubocop.yml +0 -0
- data/.solargraph.yml +0 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/Gemfile.lock +33 -22
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/lib/istox/constants/error.rb +0 -0
- data/lib/istox/helpers/_tmp_07f8e7bcecafce66_common_helper.rb.rb +67 -0
- data/lib/istox/helpers/f_math.rb +0 -0
- data/lib/istox/helpers/graphql_client.rb +0 -0
- data/lib/istox/helpers/gruf_listener_hook.rb +0 -0
- data/lib/istox/helpers/messaging.rb +28 -3
- data/lib/istox/helpers/my_open_struct.rb +0 -0
- data/lib/istox/helpers/order_book_prorate.rb +0 -0
- data/lib/istox/helpers/rate_limit.rb +0 -0
- data/lib/istox/helpers/regex_helper.rb +0 -0
- data/lib/istox/helpers/result_handler.rb +0 -0
- data/lib/istox/helpers/sns_publisher.rb +7 -3
- data/lib/istox/helpers/vault.rb +0 -0
- data/lib/istox/interfaces/chainhub/transaction.rb +0 -0
- data/lib/istox/models/blockchain_receipt.rb +0 -0
- data/lib/istox/models/concerns/blockchain_receipt_query.rb +0 -0
- data/lib/istox/quant/bond.rb +2 -2
- data/lib/istox/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0f76254354c787d196965bd5503fefba1ee58f84a7a8cad6d966a0e7611a8d72
|
|
4
|
+
data.tar.gz: af5c05d1a64325f9c5d90134fa7d1665cb18e89a7560c1dc3884141eb1351b03
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bccd4e68fa2d2033b72998902ccccde5b235e2f757eca076dae20c11bae856e50ea33aca985d8a3c20258ef0b3a448bc4cd789c28a39cb61469b5c87200b59d6
|
|
7
|
+
data.tar.gz: 6ac27dae6bdda5df087c8631a6d1147433f7834016bb076bb53a53fb9eea49448f83afddbbc6df69f9fa9070b29271dc7dd1b60a7dc528c5cf6d6165215d58cb
|
data/.gitignore
CHANGED
|
File without changes
|
data/.rubocop.yml
CHANGED
|
File without changes
|
data/.solargraph.yml
CHANGED
|
File without changes
|
data/CODE_OF_CONDUCT.md
CHANGED
|
File without changes
|
data/Gemfile
CHANGED
|
File without changes
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
istox (0.
|
|
4
|
+
istox (0.2.3.pre.1)
|
|
5
5
|
amazing_print
|
|
6
6
|
awesome_print
|
|
7
7
|
aws-sdk-sns (~> 1)
|
|
@@ -64,10 +64,10 @@ GEM
|
|
|
64
64
|
i18n (>= 0.7, < 2)
|
|
65
65
|
minitest (~> 5.1)
|
|
66
66
|
tzinfo (~> 1.1)
|
|
67
|
-
amazing_print (1.
|
|
67
|
+
amazing_print (1.3.0)
|
|
68
68
|
amq-protocol (2.3.2)
|
|
69
69
|
arel (9.0.0)
|
|
70
|
-
awesome_print (1.
|
|
70
|
+
awesome_print (1.9.2)
|
|
71
71
|
aws-eventstream (1.1.0)
|
|
72
72
|
aws-partitions (1.318.0)
|
|
73
73
|
aws-sdk-core (3.96.1)
|
|
@@ -86,7 +86,7 @@ GEM
|
|
|
86
86
|
aws-xray-sdk (0.11.4)
|
|
87
87
|
aws-sdk-xray (~> 1.4.0)
|
|
88
88
|
multi_json (~> 1)
|
|
89
|
-
binding_of_caller (0.
|
|
89
|
+
binding_of_caller (1.0.0)
|
|
90
90
|
debug_inspector (>= 0.0.1)
|
|
91
91
|
builder (3.2.4)
|
|
92
92
|
bullet (5.7.6)
|
|
@@ -99,8 +99,9 @@ GEM
|
|
|
99
99
|
concurrent-ruby (1.1.6)
|
|
100
100
|
crass (1.0.6)
|
|
101
101
|
database_cleaner (1.6.2)
|
|
102
|
-
debug_inspector (
|
|
102
|
+
debug_inspector (1.1.0)
|
|
103
103
|
diff-lcs (1.3)
|
|
104
|
+
e2mmap (0.1.0)
|
|
104
105
|
erubi (1.9.0)
|
|
105
106
|
exponential-backoff (0.0.4)
|
|
106
107
|
factory_bot (4.8.2)
|
|
@@ -112,34 +113,40 @@ GEM
|
|
|
112
113
|
i18n (~> 0.5)
|
|
113
114
|
fakeredis (0.7.0)
|
|
114
115
|
redis (>= 3.2, < 5.0)
|
|
115
|
-
faraday (1.0
|
|
116
|
+
faraday (1.3.0)
|
|
117
|
+
faraday-net_http (~> 1.0)
|
|
116
118
|
multipart-post (>= 1.2, < 3)
|
|
119
|
+
ruby2_keywords
|
|
120
|
+
faraday-net_http (1.0.1)
|
|
117
121
|
faraday_middleware (1.0.0)
|
|
118
122
|
faraday (~> 1.0)
|
|
119
|
-
ffi (1.
|
|
123
|
+
ffi (1.15.0)
|
|
120
124
|
globalid (0.4.2)
|
|
121
125
|
activesupport (>= 4.2.0)
|
|
122
|
-
google-protobuf (3.
|
|
123
|
-
googleapis-common-protos-types (1.0.
|
|
124
|
-
google-protobuf (~> 3.
|
|
125
|
-
graphlient (0.
|
|
126
|
+
google-protobuf (3.15.6-universal-darwin)
|
|
127
|
+
googleapis-common-protos-types (1.0.6)
|
|
128
|
+
google-protobuf (~> 3.14)
|
|
129
|
+
graphlient (0.5.0)
|
|
126
130
|
faraday (>= 1.0)
|
|
127
131
|
faraday_middleware
|
|
128
132
|
graphql-client
|
|
129
|
-
graphql (1.
|
|
133
|
+
graphql (1.12.6)
|
|
130
134
|
graphql-client (0.16.0)
|
|
131
135
|
activesupport (>= 3.0)
|
|
132
136
|
graphql (~> 1.8)
|
|
133
|
-
grpc (1.
|
|
134
|
-
google-protobuf (~> 3.
|
|
137
|
+
grpc (1.36.0-universal-darwin)
|
|
138
|
+
google-protobuf (~> 3.14)
|
|
135
139
|
googleapis-common-protos-types (~> 1.0)
|
|
136
|
-
grpc-tools (1.
|
|
137
|
-
gruf (2.
|
|
140
|
+
grpc-tools (1.36.0)
|
|
141
|
+
gruf (2.9.1)
|
|
138
142
|
activesupport (> 4)
|
|
139
143
|
concurrent-ruby (> 1)
|
|
144
|
+
e2mmap (~> 0.1)
|
|
140
145
|
grpc (~> 1.10)
|
|
141
146
|
grpc-tools (~> 1.10)
|
|
147
|
+
json (>= 2.3)
|
|
142
148
|
slop (~> 4.6)
|
|
149
|
+
thwait (~> 0.1)
|
|
143
150
|
hashie (3.5.7)
|
|
144
151
|
i18n (0.9.5)
|
|
145
152
|
concurrent-ruby (~> 1.0)
|
|
@@ -150,6 +157,7 @@ GEM
|
|
|
150
157
|
grpc-tools (~> 1.10)
|
|
151
158
|
slop (~> 4.6)
|
|
152
159
|
jmespath (1.4.0)
|
|
160
|
+
json (2.5.1)
|
|
153
161
|
listen (3.0.8)
|
|
154
162
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
155
163
|
rb-inotify (~> 0.9, >= 0.9.7)
|
|
@@ -170,11 +178,11 @@ GEM
|
|
|
170
178
|
nio4r (2.3.1)
|
|
171
179
|
nokogiri (1.10.9)
|
|
172
180
|
mini_portile2 (~> 2.4.0)
|
|
173
|
-
oj (3.
|
|
174
|
-
ougai (
|
|
181
|
+
oj (3.11.3)
|
|
182
|
+
ougai (2.0.0)
|
|
175
183
|
oj (~> 3.10)
|
|
176
|
-
paranoia (2.4.
|
|
177
|
-
activerecord (>= 4.0, < 6.
|
|
184
|
+
paranoia (2.4.3)
|
|
185
|
+
activerecord (>= 4.0, < 6.2)
|
|
178
186
|
pry (0.12.2)
|
|
179
187
|
coderay (~> 1.1.0)
|
|
180
188
|
method_source (~> 0.9.0)
|
|
@@ -222,7 +230,7 @@ GEM
|
|
|
222
230
|
redis-activesupport (5.2.0)
|
|
223
231
|
activesupport (>= 3, < 7)
|
|
224
232
|
redis-store (>= 1.3, < 2)
|
|
225
|
-
redis-namespace (1.8.
|
|
233
|
+
redis-namespace (1.8.1)
|
|
226
234
|
redis (>= 3.0.4)
|
|
227
235
|
redis-rack (2.1.3)
|
|
228
236
|
rack (>= 2.0.8, < 3)
|
|
@@ -254,6 +262,7 @@ GEM
|
|
|
254
262
|
rspec-mocks (~> 3.8.0)
|
|
255
263
|
rspec-support (~> 3.8.0)
|
|
256
264
|
rspec-support (3.8.0)
|
|
265
|
+
ruby2_keywords (0.0.4)
|
|
257
266
|
slop (4.8.2)
|
|
258
267
|
sprockets (3.7.2)
|
|
259
268
|
concurrent-ruby (~> 1.0)
|
|
@@ -265,11 +274,13 @@ GEM
|
|
|
265
274
|
sqlite3 (1.3.13)
|
|
266
275
|
thor (0.20.3)
|
|
267
276
|
thread_safe (0.3.6)
|
|
277
|
+
thwait (0.2.0)
|
|
278
|
+
e2mmap
|
|
268
279
|
timecop (0.9.1)
|
|
269
280
|
tzinfo (1.2.6)
|
|
270
281
|
thread_safe (~> 0.1)
|
|
271
282
|
uniform_notifier (1.11.0)
|
|
272
|
-
vault (0.
|
|
283
|
+
vault (0.16.0)
|
|
273
284
|
aws-sigv4
|
|
274
285
|
websocket-driver (0.7.0)
|
|
275
286
|
websocket-extensions (>= 0.1.0)
|
data/README.md
CHANGED
|
File without changes
|
data/Rakefile
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
module Istox
|
|
2
|
+
module CommonHelper
|
|
3
|
+
def self.to_datetime(input)
|
|
4
|
+
return nil if input.blank?
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
is_numeric = true if Integer input
|
|
8
|
+
rescue StandardError
|
|
9
|
+
false
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# is unix timestamp
|
|
13
|
+
is_numeric ? Time.at(input.to_i).to_datetime : Time.parse(input)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.to_boolean(input)
|
|
17
|
+
!(input.blank? || input.to_s.downcase == 'false' || input.to_s.downcase == '0')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.to_open_struct(model)
|
|
21
|
+
return nil if model.nil?
|
|
22
|
+
|
|
23
|
+
if model.is_a?(Array)
|
|
24
|
+
model.map do |item|
|
|
25
|
+
hash = deep_to_h(item).deep_transform_keys { |key| key.to_s.underscore.to_sym }
|
|
26
|
+
to_recursive_ostruct(hash)
|
|
27
|
+
end
|
|
28
|
+
else
|
|
29
|
+
hash = deep_to_h(model).deep_transform_keys { |key| key.to_s.underscore.to_sym }
|
|
30
|
+
to_recursive_ostruct(hash)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def self.to_recursive_ostruct(obj)
|
|
35
|
+
if obj.is_a?(Hash)
|
|
36
|
+
::Istox::MyOpenStruct.new(obj.map { |key, val| [key, to_recursive_ostruct(val)] }.to_h)
|
|
37
|
+
elsif obj.is_a?(Array)
|
|
38
|
+
obj.map { |o| to_recursive_ostruct(o) }
|
|
39
|
+
elsif obj.is_a?(OpenStruct)
|
|
40
|
+
::Istox::MyOpenStruct.new(obj)
|
|
41
|
+
else # Assumed to be a primitive value
|
|
42
|
+
obj
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.deep_to_h(obj)
|
|
47
|
+
if obj.is_a?(Array)
|
|
48
|
+
obj.map { |r| deep_to_h(r) }
|
|
49
|
+
elsif obj.is_a?(OpenStruct) || obj.is_a?(Hash) || (obj.methods.include?(:to_h) && obj.present?)
|
|
50
|
+
obj.to_h.transform_values do |v|
|
|
51
|
+
if v.is_a?(OpenStruct) || v.is_a?(Array)
|
|
52
|
+
deep_to_h(v)
|
|
53
|
+
else
|
|
54
|
+
v
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
else
|
|
58
|
+
obj
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.get_currency_decimal(currency)
|
|
63
|
+
return 0 if currency&.downcase == 'jpy'
|
|
64
|
+
|
|
65
|
+
2 end
|
|
66
|
+
end
|
|
67
|
+
end
|
data/lib/istox/helpers/f_math.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -23,7 +23,7 @@ module Istox
|
|
|
23
23
|
type: 'SEND_SMS',
|
|
24
24
|
data: {
|
|
25
25
|
to: targets,
|
|
26
|
-
subject: subject || 'Message from
|
|
26
|
+
subject: subject || 'Message from ADDX',
|
|
27
27
|
body: content
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -93,6 +93,7 @@ module Istox
|
|
|
93
93
|
# sample template data, it should be an array
|
|
94
94
|
# [{
|
|
95
95
|
# email: email,
|
|
96
|
+
# sid: xxxxx,
|
|
96
97
|
# istoxP1: auth.first_name,
|
|
97
98
|
# <more other sample template attributes>: <other sample template data>,
|
|
98
99
|
# }]
|
|
@@ -129,7 +130,8 @@ module Istox
|
|
|
129
130
|
email_data[:copy_emails].each do |ce|
|
|
130
131
|
next unless ce.present?
|
|
131
132
|
|
|
132
|
-
|
|
133
|
+
# uid and sid are reserved fields that should be not cloned
|
|
134
|
+
copy_email_data = email_data.clone.except(:sid).except(:uid)
|
|
133
135
|
|
|
134
136
|
# if it is just email to cc
|
|
135
137
|
if ce.is_a? String
|
|
@@ -137,7 +139,8 @@ module Istox
|
|
|
137
139
|
else
|
|
138
140
|
# if it is a object hash
|
|
139
141
|
# {
|
|
140
|
-
# email: xxxx
|
|
142
|
+
# email: xxxx,
|
|
143
|
+
# sid: xxxx,
|
|
141
144
|
# params: {
|
|
142
145
|
# istoxP1: xxxx,
|
|
143
146
|
# istoxP2: xxxx
|
|
@@ -146,6 +149,9 @@ module Istox
|
|
|
146
149
|
next unless ce[:email].present?
|
|
147
150
|
|
|
148
151
|
copy_email_data[:email] = ce[:email]
|
|
152
|
+
log.info "Checking copy email data after assigning #{copy_email_data.inspect}"
|
|
153
|
+
log.info "Checking ce #{ce[:params].inspect}"
|
|
154
|
+
|
|
149
155
|
copy_email_data = copy_email_data.merge(ce[:params])
|
|
150
156
|
end
|
|
151
157
|
|
|
@@ -157,6 +163,25 @@ module Istox
|
|
|
157
163
|
end
|
|
158
164
|
template_data_arr.concat(copy_email_data_arr)
|
|
159
165
|
end
|
|
166
|
+
|
|
167
|
+
def push_notification(template_name, template_data_arr)
|
|
168
|
+
raise ArgumentError, 'Template name and template data arr cannot be empty' if template_name.blank? || template_data_arr.nil?
|
|
169
|
+
|
|
170
|
+
return log.info 'Template data is empty, skipping this request' if template_data_arr.empty?
|
|
171
|
+
|
|
172
|
+
::Istox::Publisher.manual_publish(
|
|
173
|
+
exchange: 'message',
|
|
174
|
+
exchange_type: 'direct',
|
|
175
|
+
routing_key: 'push_notification.message',
|
|
176
|
+
message: {
|
|
177
|
+
type: 'SEND_PUSH_NOTIFICATION',
|
|
178
|
+
data: {
|
|
179
|
+
template_name: template_name,
|
|
180
|
+
template_data_arr_json: template_data_arr.to_json
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
end
|
|
160
185
|
end
|
|
161
186
|
end
|
|
162
187
|
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -14,12 +14,16 @@ module Istox
|
|
|
14
14
|
|
|
15
15
|
message = JSON.generate(message) unless message.is_a? String
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
topic = topic_arn || ENV.fetch('SNS_CLIENT_TOPIC', '')
|
|
18
|
+
|
|
19
|
+
log.info("Publishing SNS to topic: #{topic} with message: #{message}")
|
|
20
|
+
|
|
21
|
+
sns_client.publish(topic_arn: topic, message: message)
|
|
18
22
|
|
|
19
23
|
log.info('Publish to SNS successfully.')
|
|
20
24
|
rescue StandardError => e
|
|
21
|
-
log.
|
|
22
|
-
log.
|
|
25
|
+
log.info 'Unable to publish SNS message.'
|
|
26
|
+
log.info(e)
|
|
23
27
|
log.info('Failed to publish SNS, ignoring...') unless throw_exception
|
|
24
28
|
|
|
25
29
|
raise e if throw_exception
|
data/lib/istox/helpers/vault.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/istox/quant/bond.rb
CHANGED
|
@@ -190,7 +190,7 @@ module Istox
|
|
|
190
190
|
if @pay_accrued_interest
|
|
191
191
|
# accrued interest + face value discounted to the current date
|
|
192
192
|
discounted_accrued_interest = 0
|
|
193
|
-
if ex_coupon_date.nil? ||
|
|
193
|
+
if ex_coupon_date.nil? || date < ex_coupon_date
|
|
194
194
|
discounted_accrued_interest = @coupon*@face_value*accrued_interest_factor*discount_factor
|
|
195
195
|
end
|
|
196
196
|
discounted_face_value = @face_value*discount_factor
|
|
@@ -198,7 +198,7 @@ module Istox
|
|
|
198
198
|
return price
|
|
199
199
|
else
|
|
200
200
|
discounted_last_coupon = 0
|
|
201
|
-
if ex_coupon_date.nil? ||
|
|
201
|
+
if ex_coupon_date.nil? || date < ex_coupon_date
|
|
202
202
|
discounted_last_coupon = @coupon*@face_value/@coupon_frequency*discount_factor
|
|
203
203
|
end
|
|
204
204
|
discounted_face_value = @face_value*discount_factor
|
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.2.
|
|
4
|
+
version: 0.2.5.3.pre.51
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Siong Leng
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-05-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: amazing_print
|
|
@@ -494,6 +494,7 @@ files:
|
|
|
494
494
|
- lib/istox.rb
|
|
495
495
|
- lib/istox/constants/error.rb
|
|
496
496
|
- lib/istox/consumers/blockchain_status_handler.rb
|
|
497
|
+
- lib/istox/helpers/_tmp_07f8e7bcecafce66_common_helper.rb.rb
|
|
497
498
|
- lib/istox/helpers/blockchain_service.rb
|
|
498
499
|
- lib/istox/helpers/bunny_boot.rb
|
|
499
500
|
- lib/istox/helpers/common_helper.rb
|
|
@@ -542,11 +543,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
542
543
|
version: '0'
|
|
543
544
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
544
545
|
requirements:
|
|
545
|
-
- - "
|
|
546
|
+
- - ">"
|
|
546
547
|
- !ruby/object:Gem::Version
|
|
547
|
-
version:
|
|
548
|
+
version: 1.3.1
|
|
548
549
|
requirements: []
|
|
549
|
-
rubygems_version: 3.
|
|
550
|
+
rubygems_version: 3.2.11
|
|
550
551
|
signing_key:
|
|
551
552
|
specification_version: 4
|
|
552
553
|
summary: istox backend shared gem
|