istox 0.1.157.8 → 0.1.158.1

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: b20a5f70bdafe311ffc02576324bed01c75d2ae6a95d93d8ced8a3ff6faf38af
4
- data.tar.gz: fae479809eb6517be5c67cfc79125059f74cfe00978fee53ee219ce31bce0edd
3
+ metadata.gz: 4fd4361212a6baa9b4f3c29c5c5b0bfcef7b5aecf669c29d9ed5ddcfc5d0f446
4
+ data.tar.gz: 71cb99709647bb1f9cc867b685c51263b2fd185c383e355461a67b47fe255e3b
5
5
  SHA512:
6
- metadata.gz: 627932e0f956f2b7bb2819ecb589606d33cdd74191df07a862ca91c78cff61c3809f2c881a906c0af19cfd8bb758a2904e66846a4bd19a88928cbb04c367fd02
7
- data.tar.gz: 89cce563fe2225b1f0aaa23e604a737ef774145f68f19c75bc04f5105bbe7afa942c3058ceed369a8242c27c5e6e50aa637975d0d35f6f4ee97c0f236f3c71ae
6
+ metadata.gz: b488267ae4edf9ef90a6cf6921c7b0d0ca97e5e2f1633475610a27782f6da5fb26ac5ce35b17e45c42fecfc78c883eedbff1b1702ff8d3436314cf8b52bdb115
7
+ data.tar.gz: c870f1aaadaa9868e1d17cafe3f83e43f816469bd2ef8af072012df7a0fdf3022b27ca6065e30ce7833c18cb370b7f595c4bcb55e81b367dbb2f957cc48fa695
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- istox (0.1.157.5)
4
+ istox (0.1.157.9)
5
5
  amazing_print
6
6
  awesome_print
7
7
  aws-sdk-sns (~> 1)
@@ -86,14 +86,13 @@ GEM
86
86
  aws-xray-sdk (0.11.4)
87
87
  aws-sdk-xray (~> 1.4.0)
88
88
  multi_json (~> 1)
89
- bigdecimal (2.0.0)
90
89
  binding_of_caller (0.8.0)
91
90
  debug_inspector (>= 0.0.1)
92
91
  builder (3.2.4)
93
92
  bullet (5.7.6)
94
93
  activesupport (>= 3.0.0)
95
94
  uniform_notifier (~> 1.11.0)
96
- bunny (2.16.1)
95
+ bunny (2.17.0)
97
96
  amq-protocol (~> 2.3, >= 2.3.1)
98
97
  byebug (11.1.3)
99
98
  coderay (1.1.2)
@@ -127,14 +126,14 @@ GEM
127
126
  faraday (>= 1.0)
128
127
  faraday_middleware
129
128
  graphql-client
130
- graphql (1.11.3)
129
+ graphql (1.11.4)
131
130
  graphql-client (0.16.0)
132
131
  activesupport (>= 3.0)
133
132
  graphql (~> 1.8)
134
- grpc (1.31.1-universal-darwin)
135
- google-protobuf (~> 3.12)
133
+ grpc (1.32.0-universal-darwin)
134
+ google-protobuf (~> 3.13)
136
135
  googleapis-common-protos-types (~> 1.0)
137
- grpc-tools (1.31.1)
136
+ grpc-tools (1.32.0)
138
137
  gruf (2.8.1)
139
138
  activesupport (> 4)
140
139
  concurrent-ruby (> 1)
@@ -171,8 +170,7 @@ GEM
171
170
  nio4r (2.3.1)
172
171
  nokogiri (1.10.9)
173
172
  mini_portile2 (~> 2.4.0)
174
- oj (3.10.9)
175
- bigdecimal (~> 2.0)
173
+ oj (3.10.14)
176
174
  ougai (1.8.5)
177
175
  oj (~> 3.10)
178
176
  paranoia (2.4.2)
@@ -45,6 +45,11 @@ module Istox
45
45
  require 'istox/helpers/xray/rabbitmq_consumer_interceptor'
46
46
  require 'istox/helpers/xray/xray_initializer'
47
47
 
48
+ require 'istox/helpers/integration_test/grpc_client_interceptor'
49
+ require 'istox/helpers/integration_test/grpc_server_interceptor'
50
+ require 'istox/helpers/integration_test/rabbitmq_publisher_interceptor'
51
+ require 'istox/helpers/integration_test/rabbitmq_consumer_interceptor'
52
+
48
53
  require 'istox/models/blockchain_receipt'
49
54
  require 'istox/models/concerns/blockchain_receipt_query'
50
55
  require 'istox/consumers/blockchain_status_handler'
@@ -26,7 +26,12 @@ module Istox
26
26
  txhash: transaction.txn_hashes.present? ? transaction.txn_hashes.join(',') : nil)
27
27
 
28
28
  resource = begin
29
- class_eval("::#{receipt.resource_name}", __FILE__, __LINE__).find(receipt.resource_id)
29
+ cls = class_eval("::#{receipt.resource_name}", __FILE__, __LINE__)
30
+ if cls.respond_to?('with_deleted')
31
+ cls.with_deleted.find(receipt.resource_id)
32
+ else
33
+ cls.find(receipt.resource_id)
34
+ end
30
35
  rescue NameError
31
36
  log.warn "Transaction bind to #{receipt.resource_name} with id #{receipt.resource_id} class not found, skipping..."
32
37
  return
@@ -8,8 +8,8 @@ module Istox
8
8
  @@blockchain_receipt_klass
9
9
  end
10
10
 
11
- def self.request(sid:, action:, before:, execute:)
12
- start(sid: sid, action: action, before: before, execute: execute, is_request: true)
11
+ def self.request(sid:, action:, before:, execute:, request_reason: nil)
12
+ start(sid: sid, action: action, before: before, execute: execute, is_request: true, request_reason: request_reason)
13
13
  end
14
14
 
15
15
  def self.run(sid:, action:, before:, execute:)
@@ -19,7 +19,7 @@ module Istox
19
19
  private
20
20
 
21
21
  # before is the proc that will be executed before, must return the main model blockchain receipt will bind to
22
- def start(sid:, action:, before:, execute:, is_request: false)
22
+ def start(sid:, action:, before:, execute:, is_request: false, request_reason: nil)
23
23
  # create blockchain receipt first
24
24
  klass = blockchain_receipt_class
25
25
  uuid = ::SecureRandom.uuid
@@ -27,6 +27,7 @@ module Istox
27
27
  txid: uuid,
28
28
  sid: sid,
29
29
  is_request: is_request,
30
+ request_reason: request_reason,
30
31
  resource_action: action
31
32
  )
32
33
 
@@ -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
@@ -0,0 +1,11 @@
1
+ require 'istox/helpers/logger'
2
+
3
+ module Istox
4
+ module IntegrationTest
5
+ class Settings
6
+ class << self
7
+ attr_accessor :enable
8
+ end
9
+ end
10
+ end
11
+ end
@@ -130,7 +130,25 @@ module Istox
130
130
  next unless ce.present?
131
131
 
132
132
  copy_email_data = email_data.clone
133
- copy_email_data[:email] = ce
133
+
134
+ # if it is just email to cc
135
+ if ce.is_a? String
136
+ copy_email_data[:email] = ce
137
+ else
138
+ # if it is a object hash
139
+ # {
140
+ # email: xxxx
141
+ # params: {
142
+ # istoxP1: xxxx,
143
+ # istoxP2: xxxx
144
+ # }
145
+ # }
146
+ next unless ce[:email].present?
147
+
148
+ copy_email_data[:email] = ce[:email]
149
+ copy_email_data = copy_email_data.merge(ce[:params])
150
+ end
151
+
134
152
  copy_email_data.delete(:copy_emails)
135
153
  copy_email_data_arr << copy_email_data
136
154
  end
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.1.157.8'.freeze
2
+ VERSION = '0.1.158.1'.freeze
3
3
  end
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.157.8
4
+ version: 0.1.158.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siong Leng
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-17 00:00:00.000000000 Z
11
+ date: 2020-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amazing_print
@@ -511,6 +511,11 @@ files:
511
511
  - lib/istox/helpers/graphql_client.rb
512
512
  - lib/istox/helpers/grpc_client.rb
513
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
514
519
  - lib/istox/helpers/logger.rb
515
520
  - lib/istox/helpers/messaging.rb
516
521
  - lib/istox/helpers/my_open_struct.rb
@@ -539,7 +544,7 @@ files:
539
544
  homepage: http://www.abc.com
540
545
  licenses: []
541
546
  metadata: {}
542
- post_install_message:
547
+ post_install_message:
543
548
  rdoc_options: []
544
549
  require_paths:
545
550
  - lib
@@ -554,9 +559,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
554
559
  - !ruby/object:Gem::Version
555
560
  version: '0'
556
561
  requirements: []
557
- rubyforge_project:
558
- rubygems_version: 2.7.10
559
- signing_key:
562
+ rubygems_version: 3.0.6
563
+ signing_key:
560
564
  specification_version: 4
561
565
  summary: istox backend shared gem
562
566
  test_files: []