istox 0.1.154 → 0.1.155.1
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/Gemfile.lock +6 -6
 - data/lib/istox.rb +1 -0
 - data/lib/istox/helpers/formatter.rb +27 -0
 - data/lib/istox/helpers/grpc_client.rb +4 -0
 - data/lib/istox/helpers/logger.rb +1 -1
 - 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/helpers/xray/xray_initializer.rb +0 -1
 - data/lib/istox/version.rb +1 -1
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 77900ec4b0b82e5b1b7a1128c68ca5f8274c88336102c859ec10d29a8bde749e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 338432eb0c47851f7bdcaf066750b861d220e787f61769d56b8c816c4ce7004c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 654a77d8521ffadd0f41a6d4c2c8186628a983c85472280cef98a03eb45b4d8373058b761bab544db6f4464abe4546976f37e9f5495e4025344b4b14012da739
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9c63efedc40d7d5e4bf04611234f8b97f517909fae3aad6d07af42cd4e1d22ffca8d286a3a924638009d1a01458d1a50f63774ffa4af6190eaad910630935afa
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            PATH
         
     | 
| 
       2 
2 
     | 
    
         
             
              remote: .
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                istox (0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
                istox (0.1.155)
         
     | 
| 
       5 
5 
     | 
    
         
             
                  amazing_print
         
     | 
| 
       6 
6 
     | 
    
         
             
                  awesome_print
         
     | 
| 
       7 
7 
     | 
    
         
             
                  binding_of_caller
         
     | 
| 
         @@ -63,7 +63,7 @@ GEM 
     | 
|
| 
       63 
63 
     | 
    
         
             
                  i18n (>= 0.7, < 2)
         
     | 
| 
       64 
64 
     | 
    
         
             
                  minitest (~> 5.1)
         
     | 
| 
       65 
65 
     | 
    
         
             
                  tzinfo (~> 1.1)
         
     | 
| 
       66 
     | 
    
         
            -
                amazing_print (1. 
     | 
| 
      
 66 
     | 
    
         
            +
                amazing_print (1.2.0)
         
     | 
| 
       67 
67 
     | 
    
         
             
                amq-protocol (2.3.1)
         
     | 
| 
       68 
68 
     | 
    
         
             
                arel (9.0.0)
         
     | 
| 
       69 
69 
     | 
    
         
             
                awesome_print (1.8.0)
         
     | 
| 
         @@ -112,10 +112,10 @@ GEM 
     | 
|
| 
       112 
112 
     | 
    
         
             
                  multipart-post (>= 1.2, < 3)
         
     | 
| 
       113 
113 
     | 
    
         
             
                faraday_middleware (1.0.0)
         
     | 
| 
       114 
114 
     | 
    
         
             
                  faraday (~> 1.0)
         
     | 
| 
       115 
     | 
    
         
            -
                ffi (1. 
     | 
| 
      
 115 
     | 
    
         
            +
                ffi (1.13.1)
         
     | 
| 
       116 
116 
     | 
    
         
             
                globalid (0.4.2)
         
     | 
| 
       117 
117 
     | 
    
         
             
                  activesupport (>= 4.2.0)
         
     | 
| 
       118 
     | 
    
         
            -
                google-protobuf (3.12. 
     | 
| 
      
 118 
     | 
    
         
            +
                google-protobuf (3.12.2-universal-darwin)
         
     | 
| 
       119 
119 
     | 
    
         
             
                googleapis-common-protos-types (1.0.5)
         
     | 
| 
       120 
120 
     | 
    
         
             
                  google-protobuf (~> 3.11)
         
     | 
| 
       121 
121 
     | 
    
         
             
                graphlient (0.4.0)
         
     | 
| 
         @@ -126,7 +126,7 @@ GEM 
     | 
|
| 
       126 
126 
     | 
    
         
             
                graphql-client (0.16.0)
         
     | 
| 
       127 
127 
     | 
    
         
             
                  activesupport (>= 3.0)
         
     | 
| 
       128 
128 
     | 
    
         
             
                  graphql (~> 1.8)
         
     | 
| 
       129 
     | 
    
         
            -
                grpc (1.28.0)
         
     | 
| 
      
 129 
     | 
    
         
            +
                grpc (1.28.0-universal-darwin)
         
     | 
| 
       130 
130 
     | 
    
         
             
                  google-protobuf (~> 3.11)
         
     | 
| 
       131 
131 
     | 
    
         
             
                  googleapis-common-protos-types (~> 1.0)
         
     | 
| 
       132 
132 
     | 
    
         
             
                grpc-tools (1.28.0)
         
     | 
| 
         @@ -265,7 +265,7 @@ GEM 
     | 
|
| 
       265 
265 
     | 
    
         
             
                tzinfo (1.2.6)
         
     | 
| 
       266 
266 
     | 
    
         
             
                  thread_safe (~> 0.1)
         
     | 
| 
       267 
267 
     | 
    
         
             
                uniform_notifier (1.11.0)
         
     | 
| 
       268 
     | 
    
         
            -
                vault (0. 
     | 
| 
      
 268 
     | 
    
         
            +
                vault (0.14.0)
         
     | 
| 
       269 
269 
     | 
    
         
             
                  aws-sigv4
         
     | 
| 
       270 
270 
     | 
    
         
             
                websocket-driver (0.7.0)
         
     | 
| 
       271 
271 
     | 
    
         
             
                  websocket-extensions (>= 0.1.0)
         
     | 
    
        data/lib/istox.rb
    CHANGED
    
    | 
         @@ -36,6 +36,7 @@ module Istox 
     | 
|
| 
       36 
36 
     | 
    
         
             
              require 'istox/helpers/redis_manager'
         
     | 
| 
       37 
37 
     | 
    
         
             
              require 'istox/helpers/dlm'
         
     | 
| 
       38 
38 
     | 
    
         
             
              require 'istox/helpers/remote_model_cache'
         
     | 
| 
      
 39 
     | 
    
         
            +
              require 'istox/helpers/formatter'
         
     | 
| 
       39 
40 
     | 
    
         | 
| 
       40 
41 
     | 
    
         
             
              require 'istox/helpers/xray/grpc_client_xray_interceptor'
         
     | 
| 
       41 
42 
     | 
    
         
             
              require 'istox/helpers/xray/grpc_server_xray_interceptor'
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Istox
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Formatter
         
     | 
| 
      
 3 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 4 
     | 
    
         
            +
                  include ActionView::Helpers::NumberHelper
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  # format a number, eg. 20000.134 > 20,000.14
         
     | 
| 
      
 7 
     | 
    
         
            +
                  def number(input, round_mode: :half_up, precision: 2)
         
     | 
| 
      
 8 
     | 
    
         
            +
                    BigDecimal.mode(BigDecimal::ROUND_MODE, round_mode)
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                    input = 0 if input.blank?
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                    input = ::BigDecimal.new(input.to_s).round(precision, round_mode)
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                    number_with_precision(input, precision: precision, delimiter: ',')
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  # format a money, eg. 20000.134 > SGD 20,000.14, position can be :front or :behind
         
     | 
| 
      
 18 
     | 
    
         
            +
                  def money(input, round_mode: :half_up, precision: 2, currency:, position: :front)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    result = number(input, round_mode: round_mode, precision: precision)
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                    return currency + ' ' + result if position == :front
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                    result + ' ' + currency
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -15,6 +15,10 @@ module Istox 
     | 
|
| 
       15 
15 
     | 
    
         
             
                    @interceptors.push(interceptor)
         
     | 
| 
       16 
16 
     | 
    
         
             
                  end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
      
 18 
     | 
    
         
            +
                  def configure_grpc_logger
         
     | 
| 
      
 19 
     | 
    
         
            +
            	      Gruf.grpc_logger = log
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       18 
22 
     | 
    
         
             
                  def call(host_type, service, method, grpc_retries_count: 1, **keyword_args)
         
     | 
| 
       19 
23 
     | 
    
         
             
                    execute(host_type, service, method, **keyword_args)
         
     | 
| 
       20 
24 
     | 
    
         
             
                  rescue Gruf::Client::Errors::Unavailable => e
         
     | 
    
        data/lib/istox/helpers/logger.rb
    CHANGED
    
    | 
         @@ -6,7 +6,7 @@ module Istox 
     | 
|
| 
       6 
6 
     | 
    
         
             
                  return @logger if @logger.present?
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                  @logger = ::Ougai::Logger.new(STDOUT)
         
     | 
| 
       9 
     | 
    
         
            -
                  @logger.formatter = ::Ougai::Formatters::Readable.new unless  
     | 
| 
      
 9 
     | 
    
         
            +
                  @logger.formatter = ::Ougai::Formatters::Readable.new unless ENV.fetch('RAILS_ENV','development') == 'production'|| (defined?(Rails) && Rails.env.production?)
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
                  @logger
         
     | 
| 
       12 
12 
     | 
    
         
             
                end
         
     | 
| 
         @@ -4,7 +4,6 @@ require 'istox/helpers/xray/grpc_server_xray_interceptor' 
     | 
|
| 
       4 
4 
     | 
    
         
             
            require 'istox/helpers/xray/rabbitmq_publisher_interceptor'
         
     | 
| 
       5 
5 
     | 
    
         
             
            require 'istox/helpers/xray/rabbitmq_consumer_interceptor'
         
     | 
| 
       6 
6 
     | 
    
         
             
            require 'istox/helpers/logger'
         
     | 
| 
       7 
     | 
    
         
            -
            require 'aws-xray-sdk'
         
     | 
| 
       8 
7 
     | 
    
         | 
| 
       9 
8 
     | 
    
         
             
            module Istox
         
     | 
| 
       10 
9 
     | 
    
         
             
              module Xray
         
     | 
    
        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.155.1
         
     | 
| 
       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-06 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-07-06 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: amazing_print
         
     | 
| 
         @@ -493,6 +493,7 @@ files: 
     | 
|
| 
       493 
493 
     | 
    
         
             
            - lib/istox/helpers/common_helper.rb
         
     | 
| 
       494 
494 
     | 
    
         
             
            - lib/istox/helpers/dlm.rb
         
     | 
| 
       495 
495 
     | 
    
         
             
            - lib/istox/helpers/f_math.rb
         
     | 
| 
      
 496 
     | 
    
         
            +
            - lib/istox/helpers/formatter.rb
         
     | 
| 
       496 
497 
     | 
    
         
             
            - lib/istox/helpers/graphql_client.rb
         
     | 
| 
       497 
498 
     | 
    
         
             
            - lib/istox/helpers/grpc_client.rb
         
     | 
| 
       498 
499 
     | 
    
         
             
            - lib/istox/helpers/gruf_listener_hook.rb
         
     |