Class: Unit::Account::Credit::CloseAccountRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/account/credit/close_account_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_id, reason, fraud_reason = nil) ⇒ CloseAccountRequest

Returns a new instance of CloseAccountRequest.

Parameters:

  • account_id (String)
  • reason (String)
  • fraud_reason (String) (defaults to: nil)
    • optional



14
15
16
17
18
# File 'lib/unit/models/account/credit/close_account_request.rb', line 14

def initialize(, reason, fraud_reason = nil)
  @account_id = 
  @reason = reason
  @fraud_reason = fraud_reason
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



9
10
11
# File 'lib/unit/models/account/credit/close_account_request.rb', line 9

def 
  @account_id
end

#fraud_reasonObject (readonly)

Returns the value of attribute fraud_reason.



9
10
11
# File 'lib/unit/models/account/credit/close_account_request.rb', line 9

def fraud_reason
  @fraud_reason
end

#reasonObject (readonly)

Returns the value of attribute reason.



9
10
11
# File 'lib/unit/models/account/credit/close_account_request.rb', line 9

def reason
  @reason
end

Instance Method Details

#to_json_apiObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/unit/models/account/credit/close_account_request.rb', line 20

def to_json_api
  payload = {
    data: {
      type: "creditAccountClose",
      attributes: {
        reason: reason,
        fraudReason: fraud_reason
      }
    }
  }
  payload[:data][:attributes].compact!
  payload.to_json
end