Module: Unit::Counterparty

Defined in:
lib/unit/models/counterparty/counterparty.rb,
lib/unit/models/counterparty/list_counterparty_params.rb,
lib/unit/models/counterparty/create_counterparty_request.rb,
lib/unit/models/counterparty/update_counterparty_request.rb,
lib/unit/models/counterparty/create_with_plaid_token_request.rb

Defined Under Namespace

Classes: CreateCounterpartyRequest, CreateWithPlaidTokenRequest, ListCounterpartyParams, UpdateCounterpartyRequest

Constant Summary collapse

COUNTER_PARTY_LIMIT =
100
COUNTER_PARTY_OFFSET =
0

Class Method Summary collapse

Class Method Details

.create_counterparty(customer_id:, name:, routing_number:, account_number:, account_type:, type:, tags: nil, permissions: nil, idempotency_key: nil) ⇒ Object

Create counterparty by calling Unit’s API

Parameters:

  • customer_id (String)
  • name (String)
  • routing_number (String)
  • account_number (String)
  • account_type (String)
  • type (String)
  • tags (Hash) (defaults to: nil)
    • optional

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

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

See Also:



25
26
27
28
# File 'lib/unit/models/counterparty/counterparty.rb', line 25

def create_counterparty(customer_id:, name:, routing_number:, account_number:, account_type:, type:, tags: nil, permissions: nil, idempotency_key: nil)
  request = CreateCounterpartyRequest.new(customer_id, name, routing_number, , , type, tags, permissions, idempotency_key)
  Unit::Resource::CounterpartyResource.create_counterparty(request)
end

.create_with_plaid_token(customer_id:, type:, name:, plaid_processor_token:, verify_name: nil, permissions: nil, tags: nil, idempotency_key: nil) ⇒ Object

Create counterparty with plaid token

Parameters:

  • customer_id (String)
  • type (String)
  • name (String)
  • plaid_processor_token (String)
  • verify_name (Boolean) (defaults to: nil)
    • optional

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

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

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

See Also:



40
41
42
43
# File 'lib/unit/models/counterparty/counterparty.rb', line 40

def create_with_plaid_token(customer_id:, type:, name:, plaid_processor_token:, verify_name: nil, permissions: nil, tags: nil, idempotency_key: nil)
  request = CreateWithPlaidTokenRequest.new(customer_id, type, name, plaid_processor_token, verify_name, permissions, tags, idempotency_key)
  Unit::Resource::CounterpartyResource.create_counterparty(request)
end

.delete_counterparty(counterparty_id:) ⇒ Object

Delete counterparty

Parameters:

  • counterparty_id (String)

See Also:



88
89
90
# File 'lib/unit/models/counterparty/counterparty.rb', line 88

def delete_counterparty(counterparty_id:)
  Unit::Resource::CounterpartyResource.delete(counterparty_id)
end

.get_counterparty(counterparty_id:) ⇒ Object

Get counterparty by id

Parameters:

  • counterparty_id (String)

See Also:



62
63
64
# File 'lib/unit/models/counterparty/counterparty.rb', line 62

def get_counterparty(counterparty_id:)
  Unit::Resource::CounterpartyResource.get_counterparty(counterparty_id)
end

.get_counterparty_balance(counterparty_id:) ⇒ Object

Get counterparty balance

Parameters:

  • counterparty_id (String)

See Also:



69
70
71
# File 'lib/unit/models/counterparty/counterparty.rb', line 69

def get_counterparty_balance(counterparty_id:)
  Unit::Resource::CounterpartyResource.get_counterparty_balance(counterparty_id)
end

.list_counterparty(limit: COUNTER_PARTY_LIMIT, offset: COUNTER_PARTY_OFFSET, customer_id: nil, account_number: nil, routing_number: nil, tags: nil, permissions: nil) ⇒ Object

List counterparties

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

See Also:



54
55
56
57
# File 'lib/unit/models/counterparty/counterparty.rb', line 54

def list_counterparty(limit: COUNTER_PARTY_LIMIT, offset: COUNTER_PARTY_OFFSET, customer_id: nil, account_number: nil, routing_number: nil, tags: nil, permissions: nil)
  params = ListCounterpartyParams.new(limit, offset, customer_id, , routing_number, tags, permissions)
  Unit::Resource::CounterpartyResource.list(params)
end

.update_counterparty(counterparty_id:, plaid_processor_token: nil, verify_name: nil, permissions: nil, tags: nil) ⇒ Object

Update counterparty

Parameters:

  • counterparty_id (String)
  • plaid_processor_token (String) (defaults to: nil)
  • verify_name (Boolean) (defaults to: nil)
    • optional

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

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

See Also:



80
81
82
83
# File 'lib/unit/models/counterparty/counterparty.rb', line 80

def update_counterparty(counterparty_id:, plaid_processor_token: nil, verify_name: nil, permissions: nil, tags: nil)
  request = UpdateCounterpartyRequest.new(counterparty_id, plaid_processor_token, verify_name, permissions, tags)
  Unit::Resource::CounterpartyResource.update_counterparty(request)
end