Class: Unit::Repayment::ListRepaymentParams

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/repayment/list_repayment_params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(limit = REPAYMENT_LIMIT, offset = REPAYMENT_OFFSET, account_id = nil, credit_account_id = nil, customer_id = nil, status = nil, type = nil) ⇒ ListRepaymentParams

Returns a new instance of ListRepaymentParams.

Parameters:

  • limit (Integer) (defaults to: REPAYMENT_LIMIT)
    • optional

  • offset (Integer) (defaults to: REPAYMENT_OFFSET)
    • optional

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

  • credit_account_id (String) (defaults to: nil)
    • optional

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

  • status (Array<String>) (defaults to: nil)
    • optional

  • type (Array<String>) (defaults to: nil)
    • optional



18
19
20
21
22
23
24
25
26
27
# File 'lib/unit/models/repayment/list_repayment_params.rb', line 18

def initialize(limit = REPAYMENT_LIMIT, offset = REPAYMENT_OFFSET,  = nil,
                = nil, customer_id = nil, status = nil, type = nil)
  @limit = limit
  @offset = offset
  @account_id = 
  @credit_account_id = 
  @customer_id = customer_id
  @status = status
  @type = type
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



8
9
10
# File 'lib/unit/models/repayment/list_repayment_params.rb', line 8

def 
  @account_id
end

#credit_account_idObject (readonly)

Returns the value of attribute credit_account_id.



8
9
10
# File 'lib/unit/models/repayment/list_repayment_params.rb', line 8

def 
  @credit_account_id
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



8
9
10
# File 'lib/unit/models/repayment/list_repayment_params.rb', line 8

def customer_id
  @customer_id
end

#limitObject (readonly)

Returns the value of attribute limit.



8
9
10
# File 'lib/unit/models/repayment/list_repayment_params.rb', line 8

def limit
  @limit
end

#offsetObject (readonly)

Returns the value of attribute offset.



8
9
10
# File 'lib/unit/models/repayment/list_repayment_params.rb', line 8

def offset
  @offset
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/unit/models/repayment/list_repayment_params.rb', line 8

def status
  @status
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/unit/models/repayment/list_repayment_params.rb', line 8

def type
  @type
end

Instance Method Details

#to_hashObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/unit/models/repayment/list_repayment_params.rb', line 29

def to_hash
  params = {
    "page[limit]": limit,
    "page[offset]": offset,
    "filter[accountId]": ,
    "filter[creditAccountId]": ,
    "filter[customerId]": customer_id
  }
  filters = %i[status type]
  filters.each do |filter|
    values = send(filter)
    values&.each_with_index&.map do |val, index|
      params.merge!({ "filter[#{filter}][#{index}]": val })
    end
  end
  params.compact
end