Class: Unit::ReceivedPayment::ListPaymentParams

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/received_payment/list_payment_params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(limit = RECEIVED_PAYMENT_LIMIT, offset = ACH_PAYMENT_OFFSET, account_id = nil, customer_id = nil, status = nil, include_completed = nil, tags = nil, sort = nil, include = nil) ⇒ ListPaymentParams

Returns a new instance of ListPaymentParams.

Parameters:

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

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

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

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

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

  • include_completed (Boolean) (defaults to: nil)
    • optional

  • tags (Hash) (defaults to: nil)
    • optional

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

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



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/unit/models/received_payment/list_payment_params.rb', line 20

def initialize(limit = RECEIVED_PAYMENT_LIMIT, offset = ACH_PAYMENT_OFFSET,  = nil, customer_id = nil, status = nil,
               include_completed = nil, tags = nil, sort = nil, include = nil)
  @limit = limit
  @offset = offset
  @account_id = 
  @customer_id = customer_id
  @status = status
  @include_completed = include_completed
  @tags = tags
  @sort = sort
  @include = include
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



8
9
10
# File 'lib/unit/models/received_payment/list_payment_params.rb', line 8

def 
  @account_id
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



8
9
10
# File 'lib/unit/models/received_payment/list_payment_params.rb', line 8

def customer_id
  @customer_id
end

#includeObject (readonly)

Returns the value of attribute include.



8
9
10
# File 'lib/unit/models/received_payment/list_payment_params.rb', line 8

def include
  @include
end

#include_completedObject (readonly)

Returns the value of attribute include_completed.



8
9
10
# File 'lib/unit/models/received_payment/list_payment_params.rb', line 8

def include_completed
  @include_completed
end

#limitObject (readonly)

Returns the value of attribute limit.



8
9
10
# File 'lib/unit/models/received_payment/list_payment_params.rb', line 8

def limit
  @limit
end

#offsetObject (readonly)

Returns the value of attribute offset.



8
9
10
# File 'lib/unit/models/received_payment/list_payment_params.rb', line 8

def offset
  @offset
end

#sortObject (readonly)

Returns the value of attribute sort.



8
9
10
# File 'lib/unit/models/received_payment/list_payment_params.rb', line 8

def sort
  @sort
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/unit/models/received_payment/list_payment_params.rb', line 8

def status
  @status
end

#tagsObject (readonly)

Returns the value of attribute tags.



8
9
10
# File 'lib/unit/models/received_payment/list_payment_params.rb', line 8

def tags
  @tags
end

Instance Method Details

#to_hashObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/unit/models/received_payment/list_payment_params.rb', line 33

def to_hash
  params = {
    "page[limit]": limit,
    "page[offset]": offset,
    "filter[accountId]": ,
    "filter[customerId]": customer_id,
    "filter[includeCompleted]": include_completed,
    "filter[tags]": tags,
    "sort": sort,
    "include": include&.join(",")
  }
  status&.each_with_index&.map do |val, index|
    params.merge!({ "filter[status][#{index}]": val })
  end
  params.compact
end