myinfo 0.5.3 → 0.5.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f860cff29ffed239ebff968cac5f8a7c91e9c8eba5f7111ed7525b8bf2ad3ecd
4
- data.tar.gz: 90ce8beaf3d29f396efb4cdda0fd0a422fa9018338b027670b920c88a37e8677
3
+ metadata.gz: c7aeaabc21bdd0de155e96b9306ba1c86015f70eae7f0e1aeec8ef0c8ce0e553
4
+ data.tar.gz: 26abbbb4749b9ae61c4d38ec1e4e6ab7b28dec410602b7ec448024bc0ceb726d
5
5
  SHA512:
6
- metadata.gz: 97b316a46f724eae962315695a5900a72f6191309004a28427eb86f0bc24b9f2cebb91bdb166f15e3b68e0d807c914025b1fa4784229bfc27b77d90e0e4432c2
7
- data.tar.gz: e405cdfde48f0542e7fa9201ea14fe9a2721569f046df1043f6af452065d387cc73d6d282802a9ae3c4aadfd7895d10e2b25ecf1563ef4cde814c733dfbf8636
6
+ metadata.gz: 25015c46d6e06e6d9ec2405448926e9d0482c1ee9fe5d0aadea0467afe1a830518abc376beb46757c89234322df9077ea983025330744ed071e1f28dbbab7c48
7
+ data.tar.gz: 9edf346e8b4da8d49cc95e6db9efc477b690b0b9bbbd6d680cf8a537c5ca38081c1b7dd2eac169b8dfd2050fc0bdf0a5028b8159c1e9850364f0dfcdd8017bfd
data/lib/myinfo/v3/api.rb CHANGED
@@ -51,6 +51,11 @@ module MyInfo
51
51
  end
52
52
  end
53
53
 
54
+ def api_path
55
+ path = config.gateway_path.present? ? "#{config.gateway_path}/" : ''
56
+ "#{path}#{slug}"
57
+ end
58
+
54
59
  def parse_response(response)
55
60
  if response.code == '200'
56
61
  yield
@@ -80,7 +85,7 @@ module MyInfo
80
85
  end
81
86
 
82
87
  def http
83
- url = config.gateway_url || config.base_url
88
+ url = config.gateway_host || config.base_url
84
89
  @http ||= if config.proxy.blank?
85
90
  Net::HTTP.new(url, 443)
86
91
  else
@@ -16,7 +16,7 @@ module MyInfo
16
16
  def call
17
17
  super do
18
18
  headers = header(params: params, access_token: access_token)
19
- endpoint_url = "/#{slug}?#{params.to_query}"
19
+ endpoint_url = "/#{api_path}?#{params.to_query}"
20
20
 
21
21
  response = http.request_get(endpoint_url, headers)
22
22
  parse_response(response)
@@ -17,7 +17,7 @@ module MyInfo
17
17
  def call
18
18
  super do
19
19
  headers = header(params: params)
20
- endpoint_url = "/#{slug}?#{params.to_query}"
20
+ endpoint_url = "/#{api_path}?#{params.to_query}"
21
21
 
22
22
  response = http.request_get(endpoint_url, headers)
23
23
  parse_response(response)
@@ -14,7 +14,7 @@ module MyInfo
14
14
  def call
15
15
  super do
16
16
  headers = header(params: params).merge({ 'Content-Type' => 'application/x-www-form-urlencoded' })
17
- response = http.request_post("/#{slug}", params.to_param, headers)
17
+ response = http.request_post("/#{api_path}", params.to_param, headers)
18
18
 
19
19
  parse_response(response)
20
20
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module MyInfo
4
4
  module Version
5
- WRAPPER_VERSION = '0.5.3'
5
+ WRAPPER_VERSION = '0.5.4'
6
6
  end
7
7
  end
data/lib/myinfo.rb CHANGED
@@ -30,9 +30,9 @@ module MyInfo
30
30
  # Configuration to set various properties needed to use MyInfo
31
31
  class Configuration
32
32
  attr_accessor :singpass_eservice_id, :app_id, :client_id, :proxy, :private_key, :public_cert, :client_secret,
33
- :redirect_uri, :gateway_key
33
+ :redirect_uri, :gateway_url, :gateway_key
34
34
 
35
- attr_reader :base_url, :gateway_url
35
+ attr_reader :base_url
36
36
  attr_writer :public_facing, :sandbox
37
37
 
38
38
  def initialize
@@ -49,8 +49,12 @@ module MyInfo
49
49
  "https://#{base_url}"
50
50
  end
51
51
 
52
- def gateway_url=(url)
53
- @gateway_url = url.sub('https://', '').split('/').first
52
+ def gateway_host
53
+ gateway_url&.sub('https://', '')&.split('/')&.first
54
+ end
55
+
56
+ def gateway_path
57
+ gateway_url.present? ? gateway_url.sub('https://', '').split('/')[1..].join('/') : ''
54
58
  end
55
59
 
56
60
  def public?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lim Yao Jie
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-11-14 00:00:00.000000000 Z
12
+ date: 2022-11-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jwe