Class: Unit::AuthorizationRequest::DeclineRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/authorization_request/decline_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(authorization_request_id, reason) ⇒ DeclineRequest

Returns a new instance of DeclineRequest.

Parameters:

  • authorization_request_id (String)
  • reason (String)


12
13
14
15
# File 'lib/unit/models/authorization_request/decline_request.rb', line 12

def initialize(authorization_request_id, reason)
  @authorization_request_id = authorization_request_id
  @reason = reason
end

Instance Attribute Details

#authorization_request_idObject (readonly)

Returns the value of attribute authorization_request_id.



8
9
10
# File 'lib/unit/models/authorization_request/decline_request.rb', line 8

def authorization_request_id
  @authorization_request_id
end

#reasonObject (readonly)

Returns the value of attribute reason.



8
9
10
# File 'lib/unit/models/authorization_request/decline_request.rb', line 8

def reason
  @reason
end

Instance Method Details

#to_json_apiObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/unit/models/authorization_request/decline_request.rb', line 17

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