Class: Unit::Counterparty::ListCounterpartyParams

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/counterparty/list_counterparty_params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(limit = COUNTER_PARTY_LIMIT, offset = COUNTER_PARTY_OFFSET, customer_id = nil, account_number = nil, routing_number = nil, tags = nil, permissions = nil) ⇒ ListCounterpartyParams

Returns a new instance of ListCounterpartyParams.

Parameters:

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

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

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

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

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

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

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



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

def initialize(limit = COUNTER_PARTY_LIMIT, offset = COUNTER_PARTY_OFFSET, customer_id = nil,
                = nil, routing_number = nil, tags = nil, permissions = nil)
  @limit = limit
  @offset = offset
  @customer_id = customer_id
  @account_number = 
  @routing_number = routing_number
  @tags = tags
  @permissions = permissions
end

Instance Attribute Details

#account_numberObject (readonly)

Returns the value of attribute account_number.



8
9
10
# File 'lib/unit/models/counterparty/list_counterparty_params.rb', line 8

def 
  @account_number
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



8
9
10
# File 'lib/unit/models/counterparty/list_counterparty_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/counterparty/list_counterparty_params.rb', line 8

def limit
  @limit
end

#offsetObject (readonly)

Returns the value of attribute offset.



8
9
10
# File 'lib/unit/models/counterparty/list_counterparty_params.rb', line 8

def offset
  @offset
end

#permissionsObject (readonly)

Returns the value of attribute permissions.



8
9
10
# File 'lib/unit/models/counterparty/list_counterparty_params.rb', line 8

def permissions
  @permissions
end

#routing_numberObject (readonly)

Returns the value of attribute routing_number.



8
9
10
# File 'lib/unit/models/counterparty/list_counterparty_params.rb', line 8

def routing_number
  @routing_number
end

#tagsObject (readonly)

Returns the value of attribute tags.



8
9
10
# File 'lib/unit/models/counterparty/list_counterparty_params.rb', line 8

def tags
  @tags
end

Instance Method Details

#to_hashObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/unit/models/counterparty/list_counterparty_params.rb', line 28

def to_hash
  params =
    {
      "page[limit]": limit,
      "page[offset]": offset,
      "filter[customerId]": customer_id,
      "filter[accountNumber]": ,
      "filter[routingNumber]": routing_number,
      "filter[tags]": tags
    }
  permissions&.each_with_index&.map do |val, index|
    params.merge!({ "filter[permissions][#{index}]": val })
  end
  params.compact
end