Class: Unit::Account::Deposit::CreateDepositAccountRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/account/deposit/create_deposit_account_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(deposit_product, tags = nil, relationships = nil, idempotency_key = nil) ⇒ CreateDepositAccountRequest

Returns a new instance of CreateDepositAccountRequest.

Parameters:

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

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

  • relationships (Relationship, RelationshipArray) (defaults to: nil)
    • optional



15
16
17
18
19
20
# File 'lib/unit/models/account/deposit/create_deposit_account_request.rb', line 15

def initialize(deposit_product, tags = nil, relationships = nil, idempotency_key = nil)
  @deposit_product = deposit_product
  @tags = tags
  @idempotency_key = idempotency_key
  @relationships = relationships
end

Instance Attribute Details

#deposit_productObject (readonly)

Returns the value of attribute deposit_product.



9
10
11
# File 'lib/unit/models/account/deposit/create_deposit_account_request.rb', line 9

def deposit_product
  @deposit_product
end

#idempotency_keyObject (readonly)

Returns the value of attribute idempotency_key.



9
10
11
# File 'lib/unit/models/account/deposit/create_deposit_account_request.rb', line 9

def idempotency_key
  @idempotency_key
end

#relationshipsObject (readonly)

Returns the value of attribute relationships.



9
10
11
# File 'lib/unit/models/account/deposit/create_deposit_account_request.rb', line 9

def relationships
  @relationships
end

#tagsObject (readonly)

Returns the value of attribute tags.



9
10
11
# File 'lib/unit/models/account/deposit/create_deposit_account_request.rb', line 9

def tags
  @tags
end

Instance Method Details

#to_json_apiObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/unit/models/account/deposit/create_deposit_account_request.rb', line 22

def to_json_api
  payload = {
    data: {
      type: "depositAccount",
      attributes: {
        depositProduct: deposit_product,
        tags: tags,
        idempotencyKey: idempotency_key
      },
      relationships: relationships
    }
  }
  payload[:data][:attributes].compact!
  payload.to_json
end