Class: Turnstile::Verification

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response:, remote_ip:) ⇒ Verification

Returns a new instance of Verification.



9
10
11
12
# File 'lib/turnstile/verification.rb', line 9

def initialize(response:, remote_ip:)
  @response = response
  @remote_ip = remote_ip
end

Instance Attribute Details

#remote_ipObject (readonly)

Returns the value of attribute remote_ip.



7
8
9
# File 'lib/turnstile/verification.rb', line 7

def remote_ip
  @remote_ip
end

#responseObject (readonly)

Returns the value of attribute response.



7
8
9
# File 'lib/turnstile/verification.rb', line 7

def response
  @response
end

Instance Method Details

#resultObject



14
15
16
17
18
19
20
# File 'lib/turnstile/verification.rb', line 14

def result
  @result ||= begin
    response = perform_verification

    Hashie::Mash.new(response.body)
  end
end

#success?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/turnstile/verification.rb', line 22

def success?
  result.success?
end