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 +4 -4
- data/lib/myinfo/v3/api.rb +6 -1
- data/lib/myinfo/v3/person.rb +1 -1
- data/lib/myinfo/v3/person_basic.rb +1 -1
- data/lib/myinfo/v3/token.rb +1 -1
- data/lib/myinfo/version.rb +1 -1
- data/lib/myinfo.rb +8 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c7aeaabc21bdd0de155e96b9306ba1c86015f70eae7f0e1aeec8ef0c8ce0e553
|
|
4
|
+
data.tar.gz: 26abbbb4749b9ae61c4d38ec1e4e6ab7b28dec410602b7ec448024bc0ceb726d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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
|
data/lib/myinfo/v3/person.rb
CHANGED
|
@@ -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 = "/#{
|
|
19
|
+
endpoint_url = "/#{api_path}?#{params.to_query}"
|
|
20
20
|
|
|
21
21
|
response = http.request_get(endpoint_url, headers)
|
|
22
22
|
parse_response(response)
|
data/lib/myinfo/v3/token.rb
CHANGED
|
@@ -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("/#{
|
|
17
|
+
response = http.request_post("/#{api_path}", params.to_param, headers)
|
|
18
18
|
|
|
19
19
|
parse_response(response)
|
|
20
20
|
end
|
data/lib/myinfo/version.rb
CHANGED
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
|
|
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
|
|
53
|
-
|
|
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.
|
|
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-
|
|
12
|
+
date: 2022-11-22 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: jwe
|