Class: GVIVE::Identity::Voter

Inherits:
GVIVE::Identities show all
Defined in:
lib/gvive/identity/voter.rb

Instance Attribute Summary

Attributes inherited from GVIVE::Identities

#data, #id, #photo, #response, #signature

Attributes included from Utils

#amount, #response, #response_text, #result, #status, #transaction_id, #uuid

Instance Method Summary collapse

Methods inherited from GVIVE::Identities

#id_params

Methods included from Utils

#driver_endpoint, #endpoint, #gvive_request, #http_connect, #passport_endpoint, #voter_endpoint

Methods included from Encoding

#auth_token, #hmac_digest, #request_concat

Constructor Details

#initialize(voter_id, photo = false) ⇒ Voter

Voter ID number required Optionally specify whether you want to return a Base64Encoded Photo

Parameters:

  • voter_id (String)
  • photo (Boolean) (defaults to: false)

9
10
11
# File 'lib/gvive/identity/voter.rb', line 9

def initialize(voter_id, photo = false)
  super(voter_id, photo)
end

Instance Method Details

#valid?Boolean

Implementing valid? method signature as described in Identity Class

Returns:

  • (Boolean)

14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gvive/identity/voter.rb', line 14

def valid?
  params = id_params({ vid: @id })
  
  # Voter ID does not include signature photo request
  # Let's remove this from the API request call
  params.delete(:incs)

  @response = gvive_request(voter_endpoint, params)
  @data = @response.to_o
  @response.success?
end