Class: Teligem

Inherits:
Object
  • Object
show all
Defined in:
lib/teligem.rb

Instance Method Summary collapse

Constructor Details

#initializeTeligem

Returns a new instance of Teligem.



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

def initialize
  @configs = YAML.load_file("config/secrets.yml")
end

Instance Method Details

#security_check(params) ⇒ Object

security_check(params)

Hash that must at least contains:

  • security_code: the security code sent by telipass

  • enduser_ip: the enduser ip address

  • ntu: unique transaction number sent by telipass



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/teligem.rb', line 15

def security_check(params)
  security_code = params[:security_code]
  enduser_ip    = params[:enduser_ip]
  ntu           = params[:ntu]

  unless security_code.nil? || enduser_ip.nil? || ntu.nil?
    hash = get_security_code(enduser_ip, ntu)
  end

  if !hash.nil? && (security_code == hash)
    response = true
  else
    response = false
  end

  return response
end