Class: Hamburglar::Gateways::MaxMind::Base

Inherits:
Base
  • Object
show all
Defined in:
lib/hamburglar/gateways/max_mind.rb

Direct Known Subclasses

MinFraud, TelephoneVerification

Defined Under Namespace

Classes: ResponseParser

Instance Attribute Summary

Attributes inherited from Base

#errors, #params, #response

Instance Method Summary collapse

Methods inherited from Base

#initialize, required_params, set_required_params, #validate, #validate!

Constructor Details

This class inherits a constructor from Hamburglar::Gateways::Base

Instance Method Details

#submitObject

Submit a request upstream to generate a fraud report



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/hamburglar/gateways/max_mind.rb', line 33

def submit
  if valid?
    @response = Faraday.new(:url => self.class::API_URL, ssl: {
      verify: true, ca_file: File.expand_path('../../../cacert.pem', __FILE__)
    }) do |c|
      c.request  :url_encoded
      c.response :raise_error
      c.response :follow_redirects, :limit => 10
      c.response :maxmind
      c.adapter :net_http
    end.post(self.class::API_PATH, @params).body
  end
end