Class: PasswordBreachAlert::Api::Breachedaccount

Inherits:
Base
  • Object
show all
Defined in:
lib/password_breach_alert/api/breachedaccount.rb

Constant Summary collapse

API_URL =
'https://haveibeenpwned.com/api/v2/breachedaccount/'.freeze

Constants inherited from Base

PasswordBreachAlert::Api::Base::DEFAULT_REQUEST_OPTIONS

Instance Method Summary collapse

Methods inherited from Base

#initialize, #with_wait

Constructor Details

This class inherits a constructor from PasswordBreachAlert::Api::Base

Instance Method Details

#call(account, params = nil) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/password_breach_alert/api/breachedaccount.rb', line 8

def call(, params = nil)
  query = (params || {}).reverse_merge('truncateResponse': true).to_query
  endpoint = "#{API_URL}#{account}?#{query}"

  with_wait do
    JSON.parse(URI.parse(endpoint).open(@request_options).read)
  end
end