Class: Minfraud::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/minfraud/report.rb

Overview

Report is used to perform minFraud Report Transaction API requests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Report

Returns a new instance of Report.

Parameters:

  • params (Hash) (defaults to: {})

    Hash of parameters. The only supported key is :transaction, which should have a Minfraud::Components::Report::Transaction as its value.


16
17
18
# File 'lib/minfraud/report.rb', line 16

def initialize(params = {})
  @transaction = params[:transaction]
end

Instance Attribute Details

#transactionMinfraud::Components::Report::Transaction?

The Report::Transaction component.


11
12
13
# File 'lib/minfraud/report.rb', line 11

def transaction
  @transaction
end

Instance Method Details

#report_transactionnil

Perform a request to the minFraud Report Transaction API.

Returns:

  • (nil)

Raises:


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/minfraud/report.rb', line 34

def report_transaction
  response = nil
  body     = nil
  Minfraud.connection_pool.with do |client|
    response = client.post(
      '/minfraud/v2.0/transactions/report',
      json: @transaction.to_json,
    )

    body = response.to_s
  end

  endpoint = nil
  locales  = nil
  response = ::Minfraud::HTTPService::Response.new(
    endpoint,
    locales,
    response,
    body,
  )

  ::Minfraud::ErrorHandler.examine(response)

  nil
end