Class: Biro::CredDefense::Request

Inherits:
BaseRequest show all
Defined in:
lib/biro/gateways/cred_defense/request.rb

Instance Method Summary collapse

Methods inherited from BaseRequest

#initialize, #url

Constructor Details

This class inherits a constructor from Biro::BaseRequest

Instance Method Details

#development_urlObject



11
12
13
# File 'lib/biro/gateways/cred_defense/request.rb', line 11

def development_url
  'https://test.creddefense.com/index.php/api/v2'
end

#find(document) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/biro/gateways/cred_defense/request.rb', line 19

def find(document)
  params = {
    authentication: { token: token },
    advancedsearch: { identifier_code: document }
  }

  begin
    response = RestClient.post(search_path, params.to_json, headers)
    Response.new(response)
  rescue => e
    Biro.log(:warn, "Unable to process CredDefense request")
    raise "Error at CredDefense request: #{e.message}"
  end
end

#production_urlObject



7
8
9
# File 'lib/biro/gateways/cred_defense/request.rb', line 7

def production_url
  'https://www.creddefense.com/index.php/api/v2'
end

#required_paramsObject



15
16
17
# File 'lib/biro/gateways/cred_defense/request.rb', line 15

def required_params
  [:username, :password]
end