istox 0.1.157.11.1 → 0.1.157.11.6

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: 9f27c050ff47aa360eb7fc2c431d64ece017c5cb7ae43bfb47b2fe08319afa19
4
- data.tar.gz: 6b986f010736efb42d1c26fe069ff257eb2465943c522885de5f2197f84823ff
3
+ metadata.gz: 79fdadccf1aefbf3f9fa94231c164fd6c8d78cc98e30c33a737e38fc3d8d9587
4
+ data.tar.gz: 97479d667d74a9d8a1a46fa8b474553c30323837d8a25c74f0b1a4e5c5c20e04
5
5
  SHA512:
6
- metadata.gz: 350c1bed91bbc4666e6d4a03008f5c0d1af97226583164247e270d8fde94276d43aca61db5f54a4c8aaad9694471474e79c425a10a00266f91b8e60c754e211a
7
- data.tar.gz: f9eaa41ba50c0c2579a995145ea30121a66fe4778d2e27efa7e58230b7d8b22a9cac73d148f10ec3fe6f982b629cc7a96f49f36ea000c1dc9fa36a78183cda9f
6
+ metadata.gz: 6e9b016f3904899036f86e6b19112380047b589884c123917775713ba3f9a763f9b049a5b14b566117a9f6162959afa59fb32125e2ecd68d6bf5b05aef775859
7
+ data.tar.gz: 7b7ef9208fda580d05fc0c58e9b1c050f35c62624085e0d4712ad7cfe7c58d83502bd58b8d9fc5e5e46bea098d34b73554dd3a1f0b667d1175dcd7d429d49cdb
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
@@ -58,5 +58,11 @@ module Istox
58
58
  obj
59
59
  end
60
60
  end
61
+
62
+ def self.get_currency_decimal(currency, default_decimal)
63
+ return 0 if currency&.downcase == 'jpy'
64
+
65
+ default_decimal
66
+ end
61
67
  end
62
68
  end
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 = ::Istox::CommonHelper.get_currency_decimal(currency, precision)
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
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', nil), ENV.fetch('AWS_STS_SECRET_ACCESS_KEY', nil)))
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.1'.freeze
2
+ VERSION = '0.1.157.11.6'.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.1
4
+ version: 0.1.157.11.6
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-26 00:00:00.000000000 Z
11
+ date: 2021-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amazing_print
@@ -546,7 +546,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
546
546
  - !ruby/object:Gem::Version
547
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