Class: Unit::Customer::ArchiveCustomerRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/customer/archive_customer_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(customer_id, reason = nil) ⇒ ArchiveCustomerRequest

Returns a new instance of ArchiveCustomerRequest.

Parameters:

  • customer_id (String)
  • reason (String) (defaults to: nil)
    • optional



12
13
14
15
# File 'lib/unit/models/customer/archive_customer_request.rb', line 12

def initialize(customer_id, reason = nil)
  @customer_id = customer_id
  @reason = reason
end

Instance Attribute Details

#customer_idObject (readonly)

Returns the value of attribute customer_id.



8
9
10
# File 'lib/unit/models/customer/archive_customer_request.rb', line 8

def customer_id
  @customer_id
end

#reasonObject (readonly)

Returns the value of attribute reason.



8
9
10
# File 'lib/unit/models/customer/archive_customer_request.rb', line 8

def reason
  @reason
end

Instance Method Details

#to_json_apiObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/unit/models/customer/archive_customer_request.rb', line 17

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