myinfo 0.5.1 → 0.5.3
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/README.md +4 -0
- data/lib/myinfo/v3/api.rb +4 -2
- data/lib/myinfo/version.rb +1 -1
- data/lib/myinfo.rb +6 -2
- metadata +13 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f860cff29ffed239ebff968cac5f8a7c91e9c8eba5f7111ed7525b8bf2ad3ecd
|
|
4
|
+
data.tar.gz: 90ce8beaf3d29f396efb4cdda0fd0a422fa9018338b027670b920c88a37e8677
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 97b316a46f724eae962315695a5900a72f6191309004a28427eb86f0bc24b9f2cebb91bdb166f15e3b68e0d807c914025b1fa4784229bfc27b77d90e0e4432c2
|
|
7
|
+
data.tar.gz: e405cdfde48f0542e7fa9201ea14fe9a2721569f046df1043f6af452065d387cc73d6d282802a9ae3c4aadfd7895d10e2b25ecf1563ef4cde814c733dfbf8636
|
data/README.md
CHANGED
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
config.public_cert = File.read(Rails.root.join('public_cert_location'))
|
|
23
23
|
config.sandbox = false # optional, false by default
|
|
24
24
|
config.proxy = { address: 'proxy_address', port: 'proxy_port' } # optional, nil by default
|
|
25
|
+
config.gateway_url = 'https://test_gateway_url' #optional, nil by default
|
|
26
|
+
config.gateway_key = '44d953c796cccebcec9bdc826852857ab412fbe2' #optional, nil by default
|
|
25
27
|
end
|
|
26
28
|
```
|
|
27
29
|
|
|
@@ -62,6 +64,8 @@ result = MyInfo::V3::Person.call(access_token: response.data) if response.succes
|
|
|
62
64
|
config.public_cert = File.read(Rails.root.join('public_cert_location'))
|
|
63
65
|
config.sandbox = false # optional, false by default
|
|
64
66
|
config.proxy = { address: 'proxy_address', port: 'proxy_port' } # optional, nil by default
|
|
67
|
+
config.gateway_url = 'https://test_gateway_url' #optional, nil by default
|
|
68
|
+
config.gateway_key = '44d953c796cccebcec9bdc826852857ab412fbe2' #optional, nil by default
|
|
65
69
|
end
|
|
66
70
|
```
|
|
67
71
|
|
data/lib/myinfo/v3/api.rb
CHANGED
|
@@ -41,6 +41,7 @@ module MyInfo
|
|
|
41
41
|
'Accept' => 'application/json',
|
|
42
42
|
'Cache-Control' => 'no-cache'
|
|
43
43
|
}.tap do |values|
|
|
44
|
+
values['x-api-key'] = config.gateway_key if config.gateway_key.present?
|
|
44
45
|
values['Authorization'] = auth_header(params: params, access_token: access_token) unless config.sandbox?
|
|
45
46
|
|
|
46
47
|
if support_gzip?
|
|
@@ -79,10 +80,11 @@ module MyInfo
|
|
|
79
80
|
end
|
|
80
81
|
|
|
81
82
|
def http
|
|
83
|
+
url = config.gateway_url || config.base_url
|
|
82
84
|
@http ||= if config.proxy.blank?
|
|
83
|
-
Net::HTTP.new(
|
|
85
|
+
Net::HTTP.new(url, 443)
|
|
84
86
|
else
|
|
85
|
-
Net::HTTP.new(
|
|
87
|
+
Net::HTTP.new(url, 443, config.proxy[:address], config.proxy[:port])
|
|
86
88
|
end
|
|
87
89
|
|
|
88
90
|
@http.use_ssl = true
|
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
|
|
33
|
+
:redirect_uri, :gateway_key
|
|
34
34
|
|
|
35
|
-
attr_reader :base_url
|
|
35
|
+
attr_reader :base_url, :gateway_url
|
|
36
36
|
attr_writer :public_facing, :sandbox
|
|
37
37
|
|
|
38
38
|
def initialize
|
|
@@ -49,6 +49,10 @@ 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
|
|
54
|
+
end
|
|
55
|
+
|
|
52
56
|
def public?
|
|
53
57
|
@public_facing
|
|
54
58
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
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.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lim Yao Jie
|
|
8
|
-
|
|
8
|
+
- Eileen Kang
|
|
9
|
+
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
+
date: 2022-11-14 00:00:00.000000000 Z
|
|
12
13
|
dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
|
14
15
|
name: jwe
|
|
@@ -44,14 +45,14 @@ dependencies:
|
|
|
44
45
|
requirements:
|
|
45
46
|
- - "~>"
|
|
46
47
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 6
|
|
48
|
+
version: '6'
|
|
48
49
|
type: :development
|
|
49
50
|
prerelease: false
|
|
50
51
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
52
|
requirements:
|
|
52
53
|
- - "~>"
|
|
53
54
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 6
|
|
55
|
+
version: '6'
|
|
55
56
|
- !ruby/object:Gem::Dependency
|
|
56
57
|
name: rake
|
|
57
58
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -137,7 +138,7 @@ dependencies:
|
|
|
137
138
|
- !ruby/object:Gem::Version
|
|
138
139
|
version: '3.11'
|
|
139
140
|
description: Rails wrapper for MyInfo API
|
|
140
|
-
email:
|
|
141
|
+
email: eileen_kang@tech.gov.sg
|
|
141
142
|
executables: []
|
|
142
143
|
extensions: []
|
|
143
144
|
extra_rdoc_files: []
|
|
@@ -157,14 +158,15 @@ files:
|
|
|
157
158
|
homepage: https://github.com/GovTechSG/myinfo-rails
|
|
158
159
|
licenses:
|
|
159
160
|
- MIT
|
|
160
|
-
metadata:
|
|
161
|
-
|
|
161
|
+
metadata:
|
|
162
|
+
rubygems_mfa_required: 'true'
|
|
163
|
+
post_install_message:
|
|
162
164
|
rdoc_options: []
|
|
163
165
|
require_paths:
|
|
164
166
|
- lib
|
|
165
167
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
168
|
requirements:
|
|
167
|
-
- - "
|
|
169
|
+
- - ">="
|
|
168
170
|
- !ruby/object:Gem::Version
|
|
169
171
|
version: '2.7'
|
|
170
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
@@ -173,8 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
173
175
|
- !ruby/object:Gem::Version
|
|
174
176
|
version: '0'
|
|
175
177
|
requirements: []
|
|
176
|
-
rubygems_version: 3.1
|
|
177
|
-
signing_key:
|
|
178
|
+
rubygems_version: 3.0.3.1
|
|
179
|
+
signing_key:
|
|
178
180
|
specification_version: 4
|
|
179
181
|
summary: Rails wrapper for MyInfo API
|
|
180
182
|
test_files: []
|