hiu_auth 0.0.2 → 0.0.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hiu_auth.rb +16 -21
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1739918424178fc4fffa6fcdecfd94ab7af72da121933f4552a7fd96800966c1
4
- data.tar.gz: bf00c428cd763a08212fefc2a8217f0594d7223aec32200e8ac23f80a2874197
3
+ metadata.gz: '0399dbc8f45c03df25538af61bbffdeae10c0facb873f0a1daf945889435d104'
4
+ data.tar.gz: 64db1f23aa1bc0512c2ef31e73c5636f0c2de47992f310e4010af168f989ff4e
5
5
  SHA512:
6
- metadata.gz: bfa831e85a9b135404b703301719652cb0ca2f00b736ce1561bac77a2c7aafa94bf61d670b2d5fbf9866b04df0a3e8078bc7b4c9156f4bc29c6aa26753683b77
7
- data.tar.gz: dcc6874efabe0028c88222c35df54f84c6a0998e23f422c6c5d3f36eb0127699d3e3fb1b5cf9e419c2a49a072d220a04cf4b352751a6def1d5712fc08f8dfcac
6
+ metadata.gz: b2cf8b9c3fe3589af74d58faa6ac03ae7d8abf8c44b325a6e98acd3d7fd4a8cad9aa53b09b4f1dfca186a9b801df1a5046b99ffcea5a883c6d1b3a257428bbbd
7
+ data.tar.gz: 161bf99cfe75218a390d9bdb6ba38f4e84e0b29ffc5a48b9ded40124cf41b797a28e5ea3d51c6ab976523b8adde486cfa2b54ca6f3f76c21ee433d3dcb617aeb
data/lib/hiu_auth.rb CHANGED
@@ -1,25 +1,20 @@
1
1
 
2
- module HiuAuth
3
- include ActiveSupport::Concern
4
-
5
- included do
6
-
7
- # Verify google id token from google credential response
8
- # Arguments:
9
- # id_token: (String)
10
- #
11
- # Output: [is_success(boolean), data(Hash)]
12
- def verify_google_credential(id_token)
13
- base_url = 'https://www.googleapis.com'
14
- uri = "/oauth2/v3/tokeninfo?id_token=#{id_token}"
15
- headers = { 'Content-Type': 'application/json' }
16
- request = Http.new(base_url, uri, :get, headers)
17
- response = request.call
18
- if response.status == 200
19
- data = JSON.parse(response.body)
20
- return [true, data]
21
- end
22
- [false]
2
+ class HiuAuth
3
+ # Verify google id token from google credential response
4
+ # Arguments:
5
+ # id_token: (String)
6
+ #
7
+ # Output: [is_success(boolean), data(Hash)]
8
+ def self.verify_google_credential(id_token)
9
+ base_url = 'https://www.googleapis.com'
10
+ uri = "/oauth2/v3/tokeninfo?id_token=#{id_token}"
11
+ headers = { 'Content-Type': 'application/json' }
12
+ request = Http.new(base_url, uri, :get, headers)
13
+ response = request.call
14
+ if response.status == 200
15
+ data = JSON.parse(response.body)
16
+ return [true, data]
23
17
  end
18
+ [false]
24
19
  end
25
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiu_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dino Hiu