Class: Unit::Counterparty::CreateWithPlaidTokenRequest

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(customer_id, type, name, plaid_processor_token, verify_name = nil, permissions = nil, tags = nil, idempotency_key = nil) ⇒ CreateWithPlaidTokenRequest

Returns a new instance of CreateWithPlaidTokenRequest.

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



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

def initialize(customer_id, type, name, plaid_processor_token, verify_name = nil, permissions = nil, tags = nil, idempotency_key = nil)
  @customer_id = customer_id
  @type = type
  @name = name
  @plaid_processor_token = plaid_processor_token
  @verify_name = verify_name
  @permissions = permissions
  @tags = tags
  @idempotency_key = idempotency_key
end

Instance Attribute Details

#customer_idObject (readonly)

Returns the value of attribute customer_id.



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

def permissions
  @permissions
end

#plaid_processor_tokenObject (readonly)

Returns the value of attribute plaid_processor_token.



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

def plaid_processor_token
  @plaid_processor_token
end

#tagsObject (readonly)

Returns the value of attribute tags.



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

def type
  @type
end

#verify_nameObject (readonly)

Returns the value of attribute verify_name.



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

def verify_name
  @verify_name
end

Instance Method Details

#to_json_apiObject



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

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