istox 0.1.157.11.t4 → 0.1.157.11.4

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: 96e4c1d66416166966ff6ce9dfc4a23fe6cd2d69625b767caec16b8f0e31d6f9
4
- data.tar.gz: 7847d3d004d19e99be35807cb19995e6d7894eea4c435905a4238cb2da02030f
3
+ metadata.gz: ad9280d41ae6de8ee941f75d80dac2ecacaf0a2e0d7d884f3d7e7839c07cbc68
4
+ data.tar.gz: e17f4f264ec1c0bc00232c32996ef7e63ab7ae38b0492201556bfbc86371e541
5
5
  SHA512:
6
- metadata.gz: ada2bef07af903c7e7e1182ffebd6344b7b52a14bedffec316e462caed04041f2ef108e929f1e470b83e01b0789351b39c19352fd730b0de964636566e725e90
7
- data.tar.gz: 5c57b6369afebbba64a9289fc2b9b9b08ca4d9fa4b906fef101d8f2e49350a51bbb2f0c09c8ea9b2a4a20593aa8e3d61838df5411b10153384429d3fe6ab7884
6
+ metadata.gz: b48333122a8469840cd7a2d3ac308aa0a864af99c01950d568b1b99cce6ea9628f043c9845e5fe86fed83e9393a767bbda022c33a6e9316866cdf6ad756c9679
7
+ data.tar.gz: 692621c761f6df109524252d9fccf9f798a48f98ba7032b1fd6401ab875586b5e36641d7df57674fe706549eeb76c845302c1e371ed7d4f9342bce9dad2ebc49
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/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -17,9 +17,13 @@ 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: 2, currency:, position: :front, abs_num: false)
20
+ def money(input, round_mode: :half_up, precision: 2, currency:, position: :front, abs_num: false, hide_currency: false)
21
+ precision = 0 if currency&.downcase == 'jpy'
22
+
21
23
  result = number(input, round_mode: round_mode, precision: precision, abs_num: abs_num)
22
24
 
25
+ return result if hide_currency
26
+
23
27
  return currency + ' ' + result if position == :front
24
28
 
25
29
  result + ' ' + currency
File without changes
@@ -3,11 +3,9 @@ require 'istox/helpers/logger'
3
3
  module Istox
4
4
  class GrpcClient
5
5
  class << self
6
- def add_host(host_type, url, ssl_certificate = nil)
6
+ def add_host(host_type, url)
7
7
  @@hosts = {} unless defined?(@@hosts)
8
- @@ssl_certs = {} unless defined?(@@ssl_certs)
9
8
 
10
- @@ssl_certs[host_type] = ssl_certificate unless ssl_certificate.nil? || ssl_certificate.empty?
11
9
  @@hosts[host_type] = url
12
10
  end
13
11
 
@@ -84,12 +82,7 @@ module Istox
84
82
 
85
83
  log.info 'Reinitiating to grpc host at ' + host_url
86
84
  t1 = Time.now
87
- grpc_options = { hostname: host_url }
88
- if @@ssl_certs[host_type]
89
- log.info '[INFO] Using SSL connection...'
90
- grpc_options[:ssl_certificate] = @@ssl_certs[host_type]
91
- end
92
- @@services[get_key(host_type, service)] = ::Gruf::Client.new(service: service, options: grpc_options, client_options: client_options)
85
+ @@services[get_key(host_type, service)] = ::Gruf::Client.new(service: service, options: { hostname: host_url }, client_options: client_options)
93
86
  log.info "Time taken for reinitiating grpc host: #{Time.now - t1} seconds"
94
87
  end
95
88
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -28,8 +28,15 @@ module Istox
28
28
  def sns_client
29
29
  return @sns_client if @sns_client.present?
30
30
 
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')))
31
+ access_key = ENV.fetch('AWS_STS_ACCESS_KEY_ID', nil)
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
33
40
 
34
41
  @sns_client = Aws::SNS::Client.new(region: ENV.fetch('AWS_REGION', 'ap-southeast-1'))
35
42
  end
File without changes
File without changes
File without changes
data/lib/istox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.1.157.11.t4'.freeze
2
+ VERSION = '0.1.157.11.4'.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.11.t4
4
+ version: 0.1.157.11.4
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-01-28 00:00:00.000000000 Z
11
+ date: 2021-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amazing_print
@@ -542,11 +542,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
542
542
  version: '0'
543
543
  required_rubygems_version: !ruby/object:Gem::Requirement
544
544
  requirements:
545
- - - ">"
545
+ - - ">="
546
546
  - !ruby/object:Gem::Version
547
- version: 1.3.1
547
+ version: '0'
548
548
  requirements: []
549
- rubygems_version: 3.0.6
549
+ rubygems_version: 3.2.11
550
550
  signing_key:
551
551
  specification_version: 4
552
552
  summary: istox backend shared gem