Class: Unit::Counterparty::CreateCounterpartyRequest

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(customer_id, name, routing_number, account_number, account_type, type, tags = nil, permissions = nil, idempotency_key = nil) ⇒ CreateCounterpartyRequest

Returns a new instance of CreateCounterpartyRequest.

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



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

def initialize(customer_id, name, routing_number, , , type, tags = nil, permissions = nil, idempotency_key = nil)
  @customer_id = customer_id
  @name = name
  @routing_number = routing_number
  @account_number = 
  @account_type = 
  @type = type
  @tags = tags
  @permissions = permissions
  @idempotency_key = idempotency_key
end

Instance Attribute Details

#account_numberObject (readonly)

Returns the value of attribute account_number.



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

def 
  @account_number
end

#account_typeObject (readonly)

Returns the value of attribute account_type.



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

def 
  @account_type
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



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

def customer_id
  @customer_id
end

#idempotency_keyObject (readonly)

Returns the value of attribute idempotency_key.



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

def idempotency_key
  @idempotency_key
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#permissionsObject (readonly)

Returns the value of attribute permissions.



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

def tags
  @tags
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#to_json_apiObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/unit/models/counterparty/create_counterparty_request.rb', line 32

def to_json_api
  payload = {
    "data": {
      "type": "achCounterparty",
      "attributes": {
        name: name,
        routingNumber: routing_number,
        accountNumber: ,
        accountType: ,
        type: type,
        tags: tags,
        permissions: permissions,
        idempotencyKey: idempotency_key
      },
      "relationships": {
        customer: Unit::Types::Relationship.new("customer", customer_id).to_hash
      }
    }
  }
  payload[:data][:attributes].compact!
  payload.to_json
end