class Google::Idtoken::Verifier::Client

API client for requesting the state of an ID token

Constants

ENDPOINT

Global REST endpoint to use

Attributes

id_token[R]

ID token to verify

Public Class Methods

new(id_token) click to toggle source

Initializes a new client bound to an ID token @param id_token [String] to verify

# File lib/google/idtoken/verifier/client.rb, line 19
def initialize(id_token)
  @id_token = id_token
end

Public Instance Methods

call() click to toggle source

Interacts with the Google API @return [Hash] the parsed JSON response @raise [Error] if any error occures

# File lib/google/idtoken/verifier/client.rb, line 26
def call
  JSON.parse(verify_call)
rescue StandardError => e
  raise Error, e.message
end

Private Instance Methods

api_endpoint_uri() click to toggle source
# File lib/google/idtoken/verifier/client.rb, line 38
def api_endpoint_uri
  URI(ENDPOINT % id_token)
end
verify_call() click to toggle source
# File lib/google/idtoken/verifier/client.rb, line 34
def verify_call
  Net::HTTP.get(api_endpoint_uri)
end