istox 0.1.157.11.7 → 0.1.158
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/.idea/.rakeTasks +7 -0
- data/.idea/encodings.xml +4 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/istox-gem.iml +12 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.idea/workspace.xml +222 -0
- data/.rubocop.yml +0 -0
- data/.solargraph.yml +0 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/lib/istox/constants/error.rb +0 -0
- data/lib/istox/helpers/common_helper.rb +0 -6
- data/lib/istox/helpers/f_math.rb +0 -0
- data/lib/istox/helpers/formatter.rb +2 -12
- data/lib/istox/helpers/graphql_client.rb +0 -0
- data/lib/istox/helpers/gruf_listener_hook.rb +0 -0
- data/lib/istox/helpers/integration-test/grpc_client_interceptor.rb +22 -0
- data/lib/istox/helpers/integration-test/grpc_server_interceptor.rb +31 -0
- data/lib/istox/helpers/integration-test/rabbitmq_consumer_interceptor.rb +32 -0
- data/lib/istox/helpers/integration-test/rabbitmq_publisher_interceptor.rb +14 -0
- data/lib/istox/helpers/integration-test/settings.rb +11 -0
- data/lib/istox/helpers/my_open_struct.rb +0 -0
- data/lib/istox/helpers/order_book_price_time.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 +3 -10
- data/lib/istox/helpers/vault.rb +0 -0
- data/lib/istox/helpers/xray/grpc_client_xray_interceptor.rb +0 -1
- data/lib/istox/helpers/xray/grpc_server_xray_interceptor.rb +0 -1
- data/lib/istox/helpers/xray/rabbitmq_consumer_interceptor.rb +0 -1
- data/lib/istox/helpers/xray/rabbitmq_publisher_interceptor.rb +0 -1
- 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/version.rb +1 -1
- metadata +16 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7846d50bc5ee84ddd5e20993c97de34d498498f88b08632aadfec6108fa1c214
|
|
4
|
+
data.tar.gz: f3baf261d398da6f3f2813e85195ca03db07a3d72137fe15bcd9cd65ab43ef75
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 861464f5af57e78042e07d9427f6a205b1a7358ae1e266f16eeee6e35fe60529f7ffffc4e0b1dcd35fda4eb0029e2ecb1b7c64f2926f4f815e6a9a826cca9261
|
|
7
|
+
data.tar.gz: 0032fe6b5d0dd9d10fdc66d29cb08e5a3fcd36133db0a73c685dc350062a4aaaf92fb134e50bd71a8161e586d46a5eb090193406c53e727424b0d2bd5bf2eeb0
|
data/.gitignore
CHANGED
|
File without changes
|
data/.idea/.rakeTasks
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
|
3
|
+
You are allowed to:
|
|
4
|
+
1. Remove rake task
|
|
5
|
+
2. Add existing rake tasks
|
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
data/.idea/encodings.xml
ADDED
data/.idea/istox-gem.iml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
|
4
|
+
<shared />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="NewModuleRootManager">
|
|
7
|
+
<content url="file://$MODULE_DIR$" />
|
|
8
|
+
<orderEntry type="inheritedJdk" />
|
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.16.6, RVM: ruby-2.5.3 [global]) [gem]" level="application" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
data/.idea/misc.xml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="JavaScriptSettings">
|
|
4
|
+
<option name="languageLevel" value="ES6" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.5.3 [global]" project-jdk-type="RUBY_SDK" />
|
|
7
|
+
</project>
|
data/.idea/modules.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/istox-gem.iml" filepath="$PROJECT_DIR$/.idea/istox-gem.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/.idea/workspace.xml
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ChangeListManager">
|
|
4
|
+
<list default="true" id="f70e0449-76c0-44d8-bcb9-7991f2a7e0f8" name="Default Changelist" comment="">
|
|
5
|
+
<change beforePath="$PROJECT_DIR$/lib/istox/helpers/publisher.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/istox/helpers/publisher.rb" afterDir="false" />
|
|
6
|
+
<change beforePath="$PROJECT_DIR$/lib/istox/version.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/istox/version.rb" afterDir="false" />
|
|
7
|
+
</list>
|
|
8
|
+
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
|
9
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
10
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
11
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
12
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
13
|
+
</component>
|
|
14
|
+
<component name="FileEditorManager">
|
|
15
|
+
<leaf>
|
|
16
|
+
<file pinned="false" current-in-tab="false">
|
|
17
|
+
<entry file="file://$PROJECT_DIR$/lib/istox/helpers/bunny_boot.rb">
|
|
18
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
19
|
+
<state relative-caret-position="165">
|
|
20
|
+
<caret line="13" column="24" selection-start-line="13" selection-start-column="24" selection-end-line="13" selection-end-column="24" />
|
|
21
|
+
</state>
|
|
22
|
+
</provider>
|
|
23
|
+
</entry>
|
|
24
|
+
</file>
|
|
25
|
+
<file pinned="false" current-in-tab="false">
|
|
26
|
+
<entry file="file://$PROJECT_DIR$/lib/istox/helpers/publisher.rb">
|
|
27
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
28
|
+
<state relative-caret-position="310">
|
|
29
|
+
<caret line="25" column="16" lean-forward="true" selection-start-line="25" selection-start-column="16" selection-end-line="25" selection-end-column="16" />
|
|
30
|
+
</state>
|
|
31
|
+
</provider>
|
|
32
|
+
</entry>
|
|
33
|
+
</file>
|
|
34
|
+
<file pinned="false" current-in-tab="false">
|
|
35
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
|
36
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
|
37
|
+
<state split_layout="SPLIT">
|
|
38
|
+
<first_editor relative-caret-position="120">
|
|
39
|
+
<caret line="8" column="51" selection-start-line="8" selection-start-column="19" selection-end-line="8" selection-end-column="51" />
|
|
40
|
+
</first_editor>
|
|
41
|
+
<second_editor />
|
|
42
|
+
</state>
|
|
43
|
+
</provider>
|
|
44
|
+
</entry>
|
|
45
|
+
</file>
|
|
46
|
+
<file pinned="false" current-in-tab="true">
|
|
47
|
+
<entry file="file://$PROJECT_DIR$/lib/istox/version.rb">
|
|
48
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
49
|
+
<state relative-caret-position="15">
|
|
50
|
+
<caret line="1" column="19" selection-start-line="1" selection-start-column="19" selection-end-line="1" selection-end-column="19" />
|
|
51
|
+
</state>
|
|
52
|
+
</provider>
|
|
53
|
+
</entry>
|
|
54
|
+
</file>
|
|
55
|
+
</leaf>
|
|
56
|
+
</component>
|
|
57
|
+
<component name="Git.Settings">
|
|
58
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
59
|
+
</component>
|
|
60
|
+
<component name="IdeDocumentHistory">
|
|
61
|
+
<option name="CHANGED_PATHS">
|
|
62
|
+
<list>
|
|
63
|
+
<option value="$PROJECT_DIR$/lib/istox/helpers/publisher.rb" />
|
|
64
|
+
<option value="$PROJECT_DIR$/lib/istox/version.rb" />
|
|
65
|
+
</list>
|
|
66
|
+
</option>
|
|
67
|
+
</component>
|
|
68
|
+
<component name="ProjectFrameBounds" extendedState="6">
|
|
69
|
+
<option name="y" value="23" />
|
|
70
|
+
<option name="width" value="1440" />
|
|
71
|
+
<option name="height" value="852" />
|
|
72
|
+
</component>
|
|
73
|
+
<component name="ProjectView">
|
|
74
|
+
<navigator proportions="" version="1">
|
|
75
|
+
<foldersAlwaysOnTop value="true" />
|
|
76
|
+
</navigator>
|
|
77
|
+
<panes>
|
|
78
|
+
<pane id="ProjectPane">
|
|
79
|
+
<subPane>
|
|
80
|
+
<expand>
|
|
81
|
+
<path>
|
|
82
|
+
<item name="istox-gem" type="b2602c69:ProjectViewProjectNode" />
|
|
83
|
+
<item name="istox-gem" type="462c0819:PsiDirectoryNode" />
|
|
84
|
+
</path>
|
|
85
|
+
<path>
|
|
86
|
+
<item name="istox-gem" type="b2602c69:ProjectViewProjectNode" />
|
|
87
|
+
<item name="istox-gem" type="462c0819:PsiDirectoryNode" />
|
|
88
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
|
89
|
+
</path>
|
|
90
|
+
<path>
|
|
91
|
+
<item name="istox-gem" type="b2602c69:ProjectViewProjectNode" />
|
|
92
|
+
<item name="istox-gem" type="462c0819:PsiDirectoryNode" />
|
|
93
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
|
94
|
+
<item name="istox" type="462c0819:PsiDirectoryNode" />
|
|
95
|
+
</path>
|
|
96
|
+
<path>
|
|
97
|
+
<item name="istox-gem" type="b2602c69:ProjectViewProjectNode" />
|
|
98
|
+
<item name="istox-gem" type="462c0819:PsiDirectoryNode" />
|
|
99
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
|
100
|
+
<item name="istox" type="462c0819:PsiDirectoryNode" />
|
|
101
|
+
<item name="helpers" type="462c0819:PsiDirectoryNode" />
|
|
102
|
+
</path>
|
|
103
|
+
<path>
|
|
104
|
+
<item name="istox-gem" type="b2602c69:ProjectViewProjectNode" />
|
|
105
|
+
<item name="istox-gem" type="462c0819:PsiDirectoryNode" />
|
|
106
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
|
107
|
+
<item name="istox" type="462c0819:PsiDirectoryNode" />
|
|
108
|
+
<item name="interfaces" type="462c0819:PsiDirectoryNode" />
|
|
109
|
+
</path>
|
|
110
|
+
<path>
|
|
111
|
+
<item name="istox-gem" type="b2602c69:ProjectViewProjectNode" />
|
|
112
|
+
<item name="istox-gem" type="462c0819:PsiDirectoryNode" />
|
|
113
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
|
114
|
+
<item name="istox" type="462c0819:PsiDirectoryNode" />
|
|
115
|
+
<item name="models" type="462c0819:PsiDirectoryNode" />
|
|
116
|
+
</path>
|
|
117
|
+
</expand>
|
|
118
|
+
<select />
|
|
119
|
+
</subPane>
|
|
120
|
+
</pane>
|
|
121
|
+
<pane id="Scope" />
|
|
122
|
+
</panes>
|
|
123
|
+
</component>
|
|
124
|
+
<component name="PropertiesComponent">
|
|
125
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
|
126
|
+
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
|
127
|
+
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
|
128
|
+
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
|
129
|
+
</component>
|
|
130
|
+
<component name="RunDashboard">
|
|
131
|
+
<option name="ruleStates">
|
|
132
|
+
<list>
|
|
133
|
+
<RuleState>
|
|
134
|
+
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
|
135
|
+
</RuleState>
|
|
136
|
+
<RuleState>
|
|
137
|
+
<option name="name" value="StatusDashboardGroupingRule" />
|
|
138
|
+
</RuleState>
|
|
139
|
+
</list>
|
|
140
|
+
</option>
|
|
141
|
+
</component>
|
|
142
|
+
<component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
|
|
143
|
+
<component name="SvnConfiguration">
|
|
144
|
+
<configuration />
|
|
145
|
+
</component>
|
|
146
|
+
<component name="TaskManager">
|
|
147
|
+
<task active="true" id="Default" summary="Default task">
|
|
148
|
+
<changelist id="f70e0449-76c0-44d8-bcb9-7991f2a7e0f8" name="Default Changelist" comment="" />
|
|
149
|
+
<created>1566200631090</created>
|
|
150
|
+
<option name="number" value="Default" />
|
|
151
|
+
<option name="presentableId" value="Default" />
|
|
152
|
+
<updated>1566200631090</updated>
|
|
153
|
+
<workItem from="1566200632743" duration="997000" />
|
|
154
|
+
</task>
|
|
155
|
+
<servers />
|
|
156
|
+
</component>
|
|
157
|
+
<component name="TimeTrackingManager">
|
|
158
|
+
<option name="totallyTimeSpent" value="1001000" />
|
|
159
|
+
</component>
|
|
160
|
+
<component name="ToolWindowManager">
|
|
161
|
+
<frame x="0" y="23" width="1440" height="852" extended-state="6" />
|
|
162
|
+
<editor active="true" />
|
|
163
|
+
<layout>
|
|
164
|
+
<window_info id="Favorites" side_tool="true" />
|
|
165
|
+
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.33547926" />
|
|
166
|
+
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
|
167
|
+
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
|
|
168
|
+
<window_info anchor="bottom" id="Database Changes" />
|
|
169
|
+
<window_info anchor="bottom" id="Version Control" />
|
|
170
|
+
<window_info anchor="bottom" id="Messages" visible="true" weight="0.42062417" />
|
|
171
|
+
<window_info anchor="bottom" id="Terminal" />
|
|
172
|
+
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
|
173
|
+
<window_info anchor="bottom" id="Message" order="0" />
|
|
174
|
+
<window_info anchor="bottom" id="Find" order="1" />
|
|
175
|
+
<window_info anchor="bottom" id="Run" order="2" />
|
|
176
|
+
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
|
177
|
+
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
|
178
|
+
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
|
179
|
+
<window_info anchor="bottom" id="TODO" order="6" />
|
|
180
|
+
<window_info anchor="right" id="Database" />
|
|
181
|
+
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
|
182
|
+
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
|
183
|
+
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
|
184
|
+
</layout>
|
|
185
|
+
</component>
|
|
186
|
+
<component name="TypeScriptGeneratedFilesManager">
|
|
187
|
+
<option name="version" value="1" />
|
|
188
|
+
</component>
|
|
189
|
+
<component name="editorHistoryManager">
|
|
190
|
+
<entry file="file://$PROJECT_DIR$/lib/istox/helpers/bunny_boot.rb">
|
|
191
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
192
|
+
<state relative-caret-position="165">
|
|
193
|
+
<caret line="13" column="24" selection-start-line="13" selection-start-column="24" selection-end-line="13" selection-end-column="24" />
|
|
194
|
+
</state>
|
|
195
|
+
</provider>
|
|
196
|
+
</entry>
|
|
197
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
|
198
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
|
199
|
+
<state split_layout="SPLIT">
|
|
200
|
+
<first_editor relative-caret-position="120">
|
|
201
|
+
<caret line="8" column="51" selection-start-line="8" selection-start-column="19" selection-end-line="8" selection-end-column="51" />
|
|
202
|
+
</first_editor>
|
|
203
|
+
<second_editor />
|
|
204
|
+
</state>
|
|
205
|
+
</provider>
|
|
206
|
+
</entry>
|
|
207
|
+
<entry file="file://$PROJECT_DIR$/lib/istox/helpers/publisher.rb">
|
|
208
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
209
|
+
<state relative-caret-position="310">
|
|
210
|
+
<caret line="25" column="16" lean-forward="true" selection-start-line="25" selection-start-column="16" selection-end-line="25" selection-end-column="16" />
|
|
211
|
+
</state>
|
|
212
|
+
</provider>
|
|
213
|
+
</entry>
|
|
214
|
+
<entry file="file://$PROJECT_DIR$/lib/istox/version.rb">
|
|
215
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
216
|
+
<state relative-caret-position="15">
|
|
217
|
+
<caret line="1" column="19" selection-start-line="1" selection-start-column="19" selection-end-line="1" selection-end-column="19" />
|
|
218
|
+
</state>
|
|
219
|
+
</provider>
|
|
220
|
+
</entry>
|
|
221
|
+
</component>
|
|
222
|
+
</project>
|
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/README.md
CHANGED
|
File without changes
|
data/Rakefile
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/istox/helpers/f_math.rb
CHANGED
|
File without changes
|
|
@@ -17,18 +17,8 @@ module Istox
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
# format a money, eg. 20000.134 > SGD 20,000.14, position can be :front or :behind, abs_num: whether to absolute the number
|
|
20
|
-
def money(input, round_mode: :half_up, precision:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
decimal_place = if precision.present?
|
|
24
|
-
precision
|
|
25
|
-
else
|
|
26
|
-
::Istox::CommonHelper.get_currency_decimal(currency)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
result = number(input, round_mode: round_mode, precision: decimal_place, abs_num: abs_num)
|
|
30
|
-
|
|
31
|
-
return result if hide_currency
|
|
20
|
+
def money(input, round_mode: :half_up, precision: 2, currency:, position: :front, abs_num: false)
|
|
21
|
+
result = number(input, round_mode: round_mode, precision: precision, abs_num: abs_num)
|
|
32
22
|
|
|
33
23
|
return currency + ' ' + result if position == :front
|
|
34
24
|
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'istox/helpers/logger'
|
|
2
|
+
|
|
3
|
+
module Istox
|
|
4
|
+
module IntegrationTest
|
|
5
|
+
class GrpcClientInterceptor < ::Gruf::Interceptors::ClientInterceptor
|
|
6
|
+
def call(request_context:)
|
|
7
|
+
request_context.metadata[:integration_test] = if ::Istox::IntegrationTest::Settings.enable
|
|
8
|
+
'1'
|
|
9
|
+
else
|
|
10
|
+
'0'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
result = yield
|
|
14
|
+
|
|
15
|
+
result
|
|
16
|
+
rescue StandardError => e
|
|
17
|
+
log.error e
|
|
18
|
+
raise e
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'istox/helpers/logger'
|
|
2
|
+
|
|
3
|
+
module Istox
|
|
4
|
+
module IntegrationTest
|
|
5
|
+
class GrpcServerInterceptor < ::Gruf::Interceptors::ServerInterceptor
|
|
6
|
+
def call
|
|
7
|
+
meta = request.active_call.metadata
|
|
8
|
+
enable_integration = (meta['integration_test'] if meta.present? && meta.key?('integration_test'))
|
|
9
|
+
|
|
10
|
+
if enable_integration == '1'
|
|
11
|
+
::Istox::IntegrationTest::Settings.enable = true
|
|
12
|
+
if ActiveRecord::Base.connection.current_database != Rails.configuration.database_configuration['integration']['database']
|
|
13
|
+
ActiveRecord::Base.establish_connection(:integration)
|
|
14
|
+
end
|
|
15
|
+
else
|
|
16
|
+
::Istox::IntegrationTest::Settings.enable = false
|
|
17
|
+
if ActiveRecord::Base.connection.current_database != Rails.configuration.database_configuration['development']['database']
|
|
18
|
+
ActiveRecord::Base.establish_connection(:development)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
result = yield # this returns the protobuf message
|
|
23
|
+
|
|
24
|
+
result
|
|
25
|
+
rescue StandardError => e
|
|
26
|
+
log.error e
|
|
27
|
+
raise e
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'istox/helpers/logger'
|
|
2
|
+
|
|
3
|
+
module Istox
|
|
4
|
+
module IntegrationTest
|
|
5
|
+
class RabbitmqConsumerInterceptor
|
|
6
|
+
def call(payload, _metadata, _delivery_info)
|
|
7
|
+
payload_hash = payload.to_h
|
|
8
|
+
|
|
9
|
+
enable_integration_test = (payload_hash[:istox_integration_test] if payload_hash.key?(:istox_integration_test))
|
|
10
|
+
|
|
11
|
+
if enable_integration_test == '1'
|
|
12
|
+
::Istox::IntegrationTest::Settings.enable = true
|
|
13
|
+
if ActiveRecord::Base.connection.current_database != Rails.configuration.database_configuration['integration']['database']
|
|
14
|
+
ActiveRecord::Base.establish_connection(:integration)
|
|
15
|
+
end
|
|
16
|
+
else
|
|
17
|
+
::Istox::IntegrationTest::Settings.enable = false
|
|
18
|
+
if ActiveRecord::Base.connection.current_database != Rails.configuration.database_configuration['development']['database']
|
|
19
|
+
ActiveRecord::Base.establish_connection(:development)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
result = yield # this returns consumer handler message
|
|
24
|
+
|
|
25
|
+
result
|
|
26
|
+
rescue StandardError => e
|
|
27
|
+
log.error e
|
|
28
|
+
raise e
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'istox/helpers/logger'
|
|
2
|
+
|
|
3
|
+
module Istox
|
|
4
|
+
module IntegrationTest
|
|
5
|
+
class RabbitmqPublisherInterceptor
|
|
6
|
+
def call(message, _options)
|
|
7
|
+
message[:istox_integration_test] = '1'
|
|
8
|
+
rescue StandardError => e
|
|
9
|
+
log.error e
|
|
10
|
+
raise e
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -14,7 +14,7 @@ module Istox
|
|
|
14
14
|
|
|
15
15
|
message = JSON.generate(message) unless message.is_a? String
|
|
16
16
|
|
|
17
|
-
sns_client.publish(topic_arn: topic_arn || ENV.fetch('
|
|
17
|
+
sns_client.publish({ topic_arn: topic_arn || ENV.fetch('PUSHER_TOPIC_ARN', ''), message: message })
|
|
18
18
|
|
|
19
19
|
log.info('Publish to SNS successfully.')
|
|
20
20
|
rescue StandardError => e
|
|
@@ -28,15 +28,8 @@ module Istox
|
|
|
28
28
|
def sns_client
|
|
29
29
|
return @sns_client if @sns_client.present?
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if access_key.present?
|
|
34
|
-
credentials = Aws::Credentials.new(ENV.fetch('AWS_STS_ACCESS_KEY_ID', nil), ENV.fetch('AWS_STS_SECRET_ACCESS_KEY', nil))
|
|
35
|
-
Aws.config.update(region: ENV.fetch('AWS_REGION', 'ap-southeast-1'),
|
|
36
|
-
credentials: credentials)
|
|
37
|
-
else
|
|
38
|
-
Aws.config.update(region: ENV.fetch('AWS_REGION', 'ap-southeast-1'))
|
|
39
|
-
end
|
|
31
|
+
Aws.config.update({ region: ENV.fetch('AWS_REGION', 'ap-southeast-1'),
|
|
32
|
+
credentials: Aws::Credentials.new(ENV.fetch('AWS_STS_ACCESS_KEY_ID'), ENV.fetch('AWS_STS_SECRET_ACCESS_KEY')) })
|
|
40
33
|
|
|
41
34
|
@sns_client = Aws::SNS::Client.new(region: ENV.fetch('AWS_REGION', 'ap-southeast-1'))
|
|
42
35
|
end
|
data/lib/istox/helpers/vault.rb
CHANGED
|
File without changes
|
|
@@ -22,7 +22,6 @@ module Istox
|
|
|
22
22
|
|
|
23
23
|
request_context.metadata[:xray_trace_id] = XRay.recorder.current_segment.trace_id
|
|
24
24
|
request_context.metadata[:xray_parent_id] = XRay.recorder.current_segment.id
|
|
25
|
-
Thread.current[:tracer_id] = XRay.recorder.current_segment.trace_id
|
|
26
25
|
|
|
27
26
|
result = yield
|
|
28
27
|
|
|
@@ -7,7 +7,6 @@ module Istox
|
|
|
7
7
|
meta = request.active_call.metadata
|
|
8
8
|
trace_id = (meta['xray_trace_id'] if meta.present? && meta.key?('xray_trace_id'))
|
|
9
9
|
parent_id = (meta['xray_parent_id'] if meta.present? && meta.key?('xray_parent_id'))
|
|
10
|
-
Thread.current[:tracer_id] = trace_id
|
|
11
10
|
|
|
12
11
|
XRay.recorder.begin_segment("#{::Istox::Xray::XrayInitializer.service_name}.grpc.#{request.method_key}",
|
|
13
12
|
trace_id: trace_id, parent_id: parent_id)
|
|
@@ -8,7 +8,6 @@ module Istox
|
|
|
8
8
|
|
|
9
9
|
trace_id = (payload_hash[:xray_trace_id] if payload_hash.key?(:xray_trace_id))
|
|
10
10
|
parent_id = (payload_hash[:xray_parent_id] if payload_hash.key?(:xray_parent_id))
|
|
11
|
-
Thread.current[:tracer_id] = trace_id
|
|
12
11
|
|
|
13
12
|
arr = [delivery_info[:exchange]&.downcase, delivery_info[:routing_key]&.downcase, payload_hash[:type]&.downcase].compact
|
|
14
13
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
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.158
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Siong Leng
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-12-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: amazing_print
|
|
@@ -480,6 +480,14 @@ extensions: []
|
|
|
480
480
|
extra_rdoc_files: []
|
|
481
481
|
files:
|
|
482
482
|
- ".gitignore"
|
|
483
|
+
- ".idea/.rakeTasks"
|
|
484
|
+
- ".idea/encodings.xml"
|
|
485
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
|
486
|
+
- ".idea/istox-gem.iml"
|
|
487
|
+
- ".idea/misc.xml"
|
|
488
|
+
- ".idea/modules.xml"
|
|
489
|
+
- ".idea/vcs.xml"
|
|
490
|
+
- ".idea/workspace.xml"
|
|
483
491
|
- ".rubocop.yml"
|
|
484
492
|
- ".solargraph.yml"
|
|
485
493
|
- CODE_OF_CONDUCT.md
|
|
@@ -503,6 +511,11 @@ files:
|
|
|
503
511
|
- lib/istox/helpers/graphql_client.rb
|
|
504
512
|
- lib/istox/helpers/grpc_client.rb
|
|
505
513
|
- lib/istox/helpers/gruf_listener_hook.rb
|
|
514
|
+
- lib/istox/helpers/integration-test/grpc_client_interceptor.rb
|
|
515
|
+
- lib/istox/helpers/integration-test/grpc_server_interceptor.rb
|
|
516
|
+
- lib/istox/helpers/integration-test/rabbitmq_consumer_interceptor.rb
|
|
517
|
+
- lib/istox/helpers/integration-test/rabbitmq_publisher_interceptor.rb
|
|
518
|
+
- lib/istox/helpers/integration-test/settings.rb
|
|
506
519
|
- lib/istox/helpers/logger.rb
|
|
507
520
|
- lib/istox/helpers/messaging.rb
|
|
508
521
|
- lib/istox/helpers/my_open_struct.rb
|
|
@@ -546,7 +559,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
546
559
|
- !ruby/object:Gem::Version
|
|
547
560
|
version: '0'
|
|
548
561
|
requirements: []
|
|
549
|
-
rubygems_version: 3.
|
|
562
|
+
rubygems_version: 3.0.6
|
|
550
563
|
signing_key:
|
|
551
564
|
specification_version: 4
|
|
552
565
|
summary: istox backend shared gem
|