myinfo 0.5.2 → 0.5.3

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: a2e8fbaf2bc21cdbcbdebcaa40e5b2057da71f654a09ea2ee245d59f1b3d2cd3
4
- data.tar.gz: 41a1e888d7ca13a631c6106f526feadf11ecbe8fbb5b2d48e3089dc35cb7f1db
3
+ metadata.gz: f860cff29ffed239ebff968cac5f8a7c91e9c8eba5f7111ed7525b8bf2ad3ecd
4
+ data.tar.gz: 90ce8beaf3d29f396efb4cdda0fd0a422fa9018338b027670b920c88a37e8677
5
5
  SHA512:
6
- metadata.gz: 48ee51d5be60f930cf18be5c8016eec5afc306471c0d60347633ec0ac9e77badff4604c68dcf4761f9562e9473a96d3c035f15730c3d60f234bb7ce21c80da40
7
- data.tar.gz: da22340e796b0a57a2547283748c09324dea4002d5784bcdedfd897bcc24846810bd6331eaf0bb83897e184200c06a177160b79b7fb49347e65b922a9042d307
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(config.base_url, 443)
85
+ Net::HTTP.new(url, 443)
84
86
  else
85
- Net::HTTP.new(config.base_url, 443, config.proxy[:address], config.proxy[:port])
87
+ Net::HTTP.new(url, 443, config.proxy[:address], config.proxy[:port])
86
88
  end
87
89
 
88
90
  @http.use_ssl = true
@@ -2,6 +2,6 @@
2
2
 
3
3
  module MyInfo
4
4
  module Version
5
- WRAPPER_VERSION = '0.5.2'
5
+ WRAPPER_VERSION = '0.5.3'
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
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
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-07 00:00:00.000000000 Z
12
+ date: 2022-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jwe