Class: Unit::Card::CreateIndividualVirtualCardRequest
- Inherits:
-
Object
- Object
- Unit::Card::CreateIndividualVirtualCardRequest
- Defined in:
- lib/unit/models/card/create_individual_virtual_card_request.rb
Instance Attribute Summary collapse
-
#account_id ⇒ Object
readonly
Returns the value of attribute account_id.
-
#customer_id ⇒ Object
readonly
Returns the value of attribute customer_id.
-
#expiry_date ⇒ Object
readonly
Returns the value of attribute expiry_date.
-
#idempotency_key ⇒ Object
readonly
Returns the value of attribute idempotency_key.
-
#limits ⇒ Object
readonly
Returns the value of attribute limits.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
-
#initialize(account_id, customer_id = nil, idempotency_key = nil, tags = nil, limits = nil, expiry_date = nil) ⇒ CreateIndividualVirtualCardRequest
constructor
A new instance of CreateIndividualVirtualCardRequest.
- #to_json_api ⇒ Object
Constructor Details
#initialize(account_id, customer_id = nil, idempotency_key = nil, tags = nil, limits = nil, expiry_date = nil) ⇒ CreateIndividualVirtualCardRequest
Returns a new instance of CreateIndividualVirtualCardRequest.
16 17 18 19 20 21 22 23 |
# File 'lib/unit/models/card/create_individual_virtual_card_request.rb', line 16 def initialize(account_id, customer_id = nil, idempotency_key = nil, = nil, limits = nil, expiry_date = nil) @account_id = account_id @customer_id = customer_id @idempotency_key = idempotency_key @tags = @limits = limits @expiry_date = expiry_date end |
Instance Attribute Details
#account_id ⇒ Object (readonly)
Returns the value of attribute account_id.
8 9 10 |
# File 'lib/unit/models/card/create_individual_virtual_card_request.rb', line 8 def account_id @account_id end |
#customer_id ⇒ Object (readonly)
Returns the value of attribute customer_id.
8 9 10 |
# File 'lib/unit/models/card/create_individual_virtual_card_request.rb', line 8 def customer_id @customer_id end |
#expiry_date ⇒ Object (readonly)
Returns the value of attribute expiry_date.
8 9 10 |
# File 'lib/unit/models/card/create_individual_virtual_card_request.rb', line 8 def expiry_date @expiry_date end |
#idempotency_key ⇒ Object (readonly)
Returns the value of attribute idempotency_key.
8 9 10 |
# File 'lib/unit/models/card/create_individual_virtual_card_request.rb', line 8 def idempotency_key @idempotency_key end |
#limits ⇒ Object (readonly)
Returns the value of attribute limits.
8 9 10 |
# File 'lib/unit/models/card/create_individual_virtual_card_request.rb', line 8 def limits @limits end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
8 9 10 |
# File 'lib/unit/models/card/create_individual_virtual_card_request.rb', line 8 def @tags end |
Instance Method Details
#to_json_api ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/unit/models/card/create_individual_virtual_card_request.rb', line 25 def to_json_api payload = { "data": { "type": "individualVirtualDebitCard", "attributes": { "idempotencyKey": idempotency_key, "tags": , "limits": limits, "expiryDate": expiry_date }, "relationships": { "account": Unit::Types::Relationship.new("depositAccount", account_id).to_hash } } } customer = { "customer": Unit::Types::Relationship.new("customer", customer_id).to_hash } unless customer_id.nil? payload[:data][:relationships].merge!(customer) unless customer.nil? payload[:data][:attributes].compact! payload.to_json end |