Class: Unit::Card::CreateBusinessVirtualDebitCardRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/card/create_business_virtual_debit_card_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_id, full_name, date_of_birth, address, phone, email, idempotency_key, tags, limits) ⇒ CreateBusinessVirtualDebitCardRequest



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

def initialize(, full_name, date_of_birth, address, phone, email,
               idempotency_key, tags, limits)
  @account_id = 
  @full_name = full_name
  @date_of_birth = date_of_birth
  @address = address
  @phone = phone
  @email = email
  @idempotency_key = idempotency_key
  @tags = tags
  @limits = limits
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



8
9
10
# File 'lib/unit/models/card/create_business_virtual_debit_card_request.rb', line 8

def 
  @account_id
end

#addressObject (readonly)

Returns the value of attribute address.



8
9
10
# File 'lib/unit/models/card/create_business_virtual_debit_card_request.rb', line 8

def address
  @address
end

#date_of_birthObject (readonly)

Returns the value of attribute date_of_birth.



8
9
10
# File 'lib/unit/models/card/create_business_virtual_debit_card_request.rb', line 8

def date_of_birth
  @date_of_birth
end

#emailObject (readonly)

Returns the value of attribute email.



8
9
10
# File 'lib/unit/models/card/create_business_virtual_debit_card_request.rb', line 8

def email
  @email
end

#full_nameObject (readonly)

Returns the value of attribute full_name.



8
9
10
# File 'lib/unit/models/card/create_business_virtual_debit_card_request.rb', line 8

def full_name
  @full_name
end

#idempotency_keyObject (readonly)

Returns the value of attribute idempotency_key.



8
9
10
# File 'lib/unit/models/card/create_business_virtual_debit_card_request.rb', line 8

def idempotency_key
  @idempotency_key
end

#limitsObject (readonly)

Returns the value of attribute limits.



8
9
10
# File 'lib/unit/models/card/create_business_virtual_debit_card_request.rb', line 8

def limits
  @limits
end

#phoneObject (readonly)

Returns the value of attribute phone.



8
9
10
# File 'lib/unit/models/card/create_business_virtual_debit_card_request.rb', line 8

def phone
  @phone
end

#tagsObject (readonly)

Returns the value of attribute tags.



8
9
10
# File 'lib/unit/models/card/create_business_virtual_debit_card_request.rb', line 8

def tags
  @tags
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/card/create_business_virtual_debit_card_request.rb', line 32

def to_json_api
  payload = {
    "data": {
      "type": "businessVirtualDebitCard",
      "attributes": {
        "fullName": full_name&.represent,
        "dateOfBirth": date_of_birth,
        "address": address&.represent,
        "phone": phone&.represent,
        "email": email,
        "idempotencyKey": idempotency_key,
        "tags": tags,
        "limits": limits
      },
      "relationships": {
        "account": Unit::Types::Relationship.new("depositAccount", ).to_hash
      }
    }
  }
  payload[:data][:attributes].compact!
  payload.to_json
end