Module: Metropol::Request::ReportReason

Included in:
Metropol::Request
Defined in:
lib/metropol/request/report_reason.rb

Constant Summary collapse

REASON_TYPES =
{
  new_credit_app: 1,
  credit_review: 2,
  verify_credit_info: 3,
  customer_request: 4
}.freeze

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object

Adds methods to specify the report reason Usage: > client.json_report.new_credit_app.national_id(‘880000088’)



19
20
21
22
23
24
25
26
# File 'lib/metropol/request/report_reason.rb', line 19

def method_missing(method_name, *args, &block)
  if valid_reason? method_name
    @payload[:report_reason] = REASON_TYPES[method_name]
    return self
  end

  super
end

Instance Method Details

#valid_reason?(reason_type) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/metropol/request/report_reason.rb', line 12

def valid_reason?(reason_type)
  REASON_TYPES.has_key? reason_type
end