Module: Util

Defined in:
lib/utils.rb

Class Method Summary collapse

Class Method Details

.checkToken(token) ⇒ Object



5
6
7
8
# File 'lib/utils.rb', line 5

def Util.checkToken(token)
  info = JWT.decode token, nil, false
  return Time.now.to_i() > info[0]["exp"]
end

.userPoolIdConverter(query, value, userPoolId) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/utils.rb', line 9

def Util.userPoolIdConverter(query, value, userPoolId)
  if query.include? "$registerInClient: String"
    value["registerInClient"] = userPoolId
  end
  if query.include? "$clientId: String"
    value["clientId"] = userPoolId
  end
  if query.include? "$userPoolId: String,"
    value["userPoolId"] = userPoolId
  end
  if query.include? "mutation register"
    value[:userInfo][:registerInClient] = userPoolId
  end
  return value
end