Module: Unit::Card

Defined in:
lib/unit/models/card/card.rb,
lib/unit/models/card/list_card_params.rb,
lib/unit/models/card/replace_card_request.rb,
lib/unit/models/card/patch_business_card_request.rb,
lib/unit/models/card/create_business_debit_card_request.rb,
lib/unit/models/card/patch_business_credit_card_request.rb,
lib/unit/models/card/create_business_credit_card_request.rb,
lib/unit/models/card/patch_business_virtual_card_request.rb,
lib/unit/models/card/create_individual_debit_card_request.rb,
lib/unit/models/card/create_individual_virtual_card_request.rb,
lib/unit/models/card/create_business_virtual_debit_card_request.rb,
lib/unit/models/card/patch_business_virtual_credit_card_request.rb,
lib/unit/models/card/create_business_virtual_credit_card_request.rb

Defined Under Namespace

Classes: CreateBusinessCreditCardRequest, CreateBusinessDebitCardRequest, CreateBusinessVirtualCreditCardRequest, CreateBusinessVirtualDebitCardRequest, CreateIndividualDebitCardRequest, CreateIndividualVirtualCardRequest, ListCardParams, PatchBusinessCardRequest, PatchBusinessCreditCardRequest, PatchBusinessVirtualCardRequest, PatchBusinessVirtualCreditCardRequest, ReplaceCardRequest

Constant Summary collapse

CARD_LIST_LIMIT =
100
CARD_LIST_OFFSET =
0

Class Method Summary collapse

Class Method Details

.close_card(card_id:) ⇒ Object

Close a card by calling Unit’s API

Parameters:

  • card_id (String)


195
196
197
# File 'lib/unit/models/card/card.rb', line 195

def close_card(card_id:)
  Unit::Resource::CardResource.close_card(card_id)
end

.create_business_credit_card(account_id:, full_name:, date_of_birth:, address:, shipping_address: nil, phone: nil, email: nil, design: nil, additional_embossed_text: nil, idempotency_key: nil, tags: nil, limits: nil, print_only_business_name: nil, expiry_date: nil) ⇒ Object

Create a new business credit card by calling Unit’s API

Parameters:

  • account_id (String)
  • full_name (FullName)
  • date_of_birth (Date)
  • address (Address)
  • shipping_address (Address) (defaults to: nil)
    • optional

  • phone (Phone) (defaults to: nil)
    • optional

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

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

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

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

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

  • limits (Hash) (defaults to: nil)
    • optional

  • print_only_business_name (Boolean) (defaults to: nil)
    • optional

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

See Also:



77
78
79
80
# File 'lib/unit/models/card/card.rb', line 77

def create_business_credit_card(account_id:, full_name:, date_of_birth:, address:, shipping_address: nil, phone: nil, email: nil, design: nil, additional_embossed_text: nil, idempotency_key: nil, tags: nil, limits: nil, print_only_business_name: nil, expiry_date: nil)
  request = CreateBusinessCreditCardRequest.new(, full_name, date_of_birth, address, shipping_address, phone, email, design, additional_embossed_text, idempotency_key, tags, limits, print_only_business_name, expiry_date)
  Unit::Resource::CardResource.create_card(request)
end

.create_business_debit_card(account_id:, full_name:, date_of_birth:, address:, phone:, email:, shipping_address: nil, design: nil, additional_embossed_text: nil, idempotency_key: nil, tags: nil, limits: nil, print_only_business_name: nil, expiry_date: nil) ⇒ Object

Create a new business debit card by calling Unit’s API

Parameters:

  • full_name (FullName)
  • date_of_birth (Date)
  • address (Address)
  • shipping_address (Address) (defaults to: nil)
    • optional

  • phone (Phone)
    • optional

  • email (String)
    • optional

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

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

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

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

  • limits (Hash) (defaults to: nil)
    • optional

  • print_only_business_name (Boolean) (defaults to: nil)
    • optional

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

See Also:



54
55
56
57
58
59
# File 'lib/unit/models/card/card.rb', line 54

def create_business_debit_card(account_id:, full_name:, date_of_birth:, address:, phone:, email:, shipping_address: nil,
                               design: nil, additional_embossed_text: nil, idempotency_key: nil, tags: nil, limits: nil, print_only_business_name: nil, expiry_date: nil)
  request = CreateBusinessDebitCardRequest.new(, full_name, date_of_birth, address, shipping_address, phone, email, design, additional_embossed_text,
                                               idempotency_key, tags, limits, print_only_business_name, expiry_date)
  Unit::Resource::CardResource.create_card(request)
end

.create_business_virtual_card(account_id:, full_name:, date_of_birth:, address:, phone: nil, email: nil, idempotency_key: nil, tags: nil, limits: nil) ⇒ Object

Create a new business virtual card by calling Unit’s API

Parameters:

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

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

  • limits (Hash) (defaults to: nil)
    • optional

See Also:



169
170
171
172
# File 'lib/unit/models/card/card.rb', line 169

def create_business_virtual_card(account_id:, full_name:, date_of_birth:, address:, phone: nil, email: nil, idempotency_key: nil, tags: nil, limits: nil)
  request = CreateBusinessVirtualDebitCardRequest.new(, full_name, date_of_birth, address, phone, email, idempotency_key, tags, limits)
  Unit::Resource::CardResource.create_card(request)
end

.create_business_virtual_credit_card(account_id:, full_name:, date_of_birth:, address:, phone: nil, email: nil, idempotency_key: nil, tags: nil, limits: nil, expiry_date: nil) ⇒ Object

Create a new business virtual credit card by calling Unit’s API

Parameters:

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

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

  • limits (Hash) (defaults to: nil)
    • optional

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

See Also:



90
91
92
93
# File 'lib/unit/models/card/card.rb', line 90

def create_business_virtual_credit_card(account_id:, full_name:, date_of_birth:, address:, phone: nil, email: nil, idempotency_key: nil, tags: nil, limits: nil, expiry_date: nil)
  request = CreateBusinessVirtualCreditCardRequest.new(, full_name, date_of_birth, address, phone, email, idempotency_key, tags, limits, expiry_date)
  Unit::Resource::CardResource.create_card(request)
end

.create_individual_debit_card(account_id:, customer_id: nil, shipping_address: nil, design: nil, additional_embossed_text: nil, idempotency_key: nil, tags: nil, limits: nil, print_only_business_name: nil, expiry_date: nil) ⇒ Object

Create a new individual debit card by calling Unit’s API

Parameters:

  • account_id (String)
  • shipping_address (Address) (defaults to: nil)
    • optional

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

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

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

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

  • limits (Hash) (defaults to: nil)
    • optional

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

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

See Also:



32
33
34
35
36
37
# File 'lib/unit/models/card/card.rb', line 32

def create_individual_debit_card(account_id:, customer_id: nil, shipping_address: nil, design: nil, additional_embossed_text: nil,
                                 idempotency_key: nil, tags: nil, limits: nil, print_only_business_name: nil, expiry_date: nil)
  request = CreateIndividualDebitCardRequest.new(, customer_id, shipping_address, design, additional_embossed_text,
                                                 idempotency_key, tags, limits, print_only_business_name, expiry_date)
  Unit::Resource::CardResource.create_card(request)
end

.create_individual_virtual_card(account_id:, customer_id: nil, idempotency_key: nil, tags: nil, limits: nil) ⇒ Object

Create a new individual virtual card by calling Unit’s API

Parameters:

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

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

  • limits (Hash) (defaults to: nil)
    • optional

See Also:



157
158
159
160
# File 'lib/unit/models/card/card.rb', line 157

def create_individual_virtual_card(account_id:, customer_id: nil, idempotency_key: nil, tags: nil, limits: nil)
  request = CreateIndividualVirtualCardRequest.new(, customer_id, idempotency_key, tags, limits)
  Unit::Resource::CardResource.create_card(request)
end

.freeze_card(card_id:) ⇒ Object

Freeze a card by calling Unit’s API

Parameters:

  • card_id (String)


201
202
203
# File 'lib/unit/models/card/card.rb', line 201

def freeze_card(card_id:)
  Unit::Resource::CardResource.freeze_card(card_id)
end

.get_card(card_id:) ⇒ Object

Get a card by id by calling Unit’s API

Parameters:

  • card_id (String)


221
222
223
# File 'lib/unit/models/card/card.rb', line 221

def get_card(card_id:)
  Unit::Resource::CardResource.get_card(card_id)
end

.get_pin_status(card_id:) ⇒ Object

Get pin status by calling Unit’s API

Parameters:

  • card_id (String)

See Also:



177
178
179
# File 'lib/unit/models/card/card.rb', line 177

def get_pin_status(card_id:)
  Unit::Resource::CardResource.get_pin_status(card_id)
end

.limits(card_id:) ⇒ Object

Get a card limits by calling Unit’s API

Parameters:

  • card_id (String)


242
243
244
# File 'lib/unit/models/card/card.rb', line 242

def limits(card_id:)
  Unit::Resource::CardResource.limits(card_id)
end

.list_cards(limit: CARD_LIST_LIMIT, offset: CARD_LIST_OFFSET, account_id: nil, customer_id: nil, tags: nil, status: nil, include: nil, sort: nil) ⇒ Object

List cards by calling Unit’s API

Parameters:

  • limit (Integer) (defaults to: CARD_LIST_LIMIT)
    • optional

  • offset (Integer) (defaults to: CARD_LIST_OFFSET)
    • optional

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

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

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

  • status (Array<String>) (defaults to: nil)
    • optional

  • include (Array) (defaults to: nil)
    • optional

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



234
235
236
237
238
# File 'lib/unit/models/card/card.rb', line 234

def list_cards(limit: CARD_LIST_LIMIT, offset: CARD_LIST_OFFSET, account_id: nil,
               customer_id: nil, tags: nil, status: nil, include: nil, sort: nil)
  request = ListCardParams.new(limit, offset, , customer_id, tags, status, include, sort)
  Unit::Resource::CardResource.list_cards(request)
end

.replace_card(card_id:, shipping_address: nil) ⇒ Object

Replace a card by calling Unit’s API

Parameters:

  • card_id (String)
  • shipping_address (Address) (defaults to: nil)
    • optional



214
215
216
217
# File 'lib/unit/models/card/card.rb', line 214

def replace_card(card_id:, shipping_address: nil)
  request = ReplaceCardRequest.new(card_id, shipping_address)
  Unit::Resource::CardResource.replace_card(request)
end

.report_lost(card_id:) ⇒ Object

Report a card as a lost by calling Unit’s API

Parameters:

  • card_id (String)


189
190
191
# File 'lib/unit/models/card/card.rb', line 189

def report_lost(card_id:)
  Unit::Resource::CardResource.report_lost(card_id)
end

.report_stolen(card_id:) ⇒ Object

Report a card as a stolen by calling Unit’s API

Parameters:

  • card_id (String)


183
184
185
# File 'lib/unit/models/card/card.rb', line 183

def report_stolen(card_id:)
  Unit::Resource::CardResource.report_stolen(card_id)
end

.unfreeze_card(card_id:) ⇒ Object

Unfreeze a card by calling Unit’s API

Parameters:

  • card_id (String)


207
208
209
# File 'lib/unit/models/card/card.rb', line 207

def unfreeze_card(card_id:)
  Unit::Resource::CardResource.unfreeze_card(card_id)
end

.update_business_credit_card(card_id:, shipping_address: nil, address: nil, phone: nil, email: nil, design: nil, tags: nil, limits: nil) ⇒ Object

Update a business credit card by calling Unit’s API

Parameters:

  • card_id (String)
  • shipping_address (Address) (defaults to: nil)
    • optional

  • address (Address) (defaults to: nil)
    • optional

  • phone (Phone) (defaults to: nil)
    • optional

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

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

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

  • limits (Hash) (defaults to: nil)
    • optional

See Also:



120
121
122
123
# File 'lib/unit/models/card/card.rb', line 120

def update_business_credit_card(card_id:, shipping_address: nil, address: nil, phone: nil, email: nil, design: nil, tags: nil, limits: nil)
  request = PatchBusinessCreditCardRequest.new(card_id, shipping_address, address, phone, email, design, tags, limits)
  Unit::Resource::CardResource.update(request)
end

.update_business_debit_card(card_id:, shipping_address: nil, address: nil, phone: nil, email: nil, design: nil, tags: nil, limits: nil) ⇒ Object

Update a business debit card by calling Unit’s API

Parameters:

  • card_id (String)
  • shipping_address (Address) (defaults to: nil)
    • optional

  • address (Address) (defaults to: nil)
    • optional

  • phone (Phone) (defaults to: nil)
    • optional

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

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

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

  • limits (Hash) (defaults to: nil)
    • optional

See Also:



105
106
107
108
# File 'lib/unit/models/card/card.rb', line 105

def update_business_debit_card(card_id:, shipping_address: nil, address: nil, phone: nil, email: nil, design: nil, tags: nil, limits: nil)
  request = PatchBusinessCardRequest.new(card_id, shipping_address, address, phone, email, design, tags, limits)
  Unit::Resource::CardResource.update(request)
end

.update_business_virtual_credit_card(card_id:, address: nil, phone: nil, email: nil, tags: nil, limits: nil) ⇒ Object

Update a business virtual credit card by calling Unit’s API

Parameters:

  • card_id (String)
  • address (Address) (defaults to: nil)
    • optional

  • phone (Phone) (defaults to: nil)
    • optional

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

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

  • limits (Hash) (defaults to: nil)
    • optional

See Also:



146
147
148
149
# File 'lib/unit/models/card/card.rb', line 146

def update_business_virtual_credit_card(card_id:, address: nil, phone: nil, email: nil, tags: nil, limits: nil)
  request = PatchBusinessVirtualCreditCardRequest.new(card_id, address, phone, email, tags, limits)
  Unit::Resource::CardResource.update(request)
end

.update_business_virtual_debit_card(card_id:, address: nil, phone: nil, email: nil, tags: nil, limits: nil) ⇒ Object

Update a business virtual debit card by calling Unit’s API

Parameters:

  • card_id (String)
  • address (Address) (defaults to: nil)
    • optional

  • phone (Phone) (defaults to: nil)
    • optional

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

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

  • limits (Hash) (defaults to: nil)
    • optional

See Also:



133
134
135
136
# File 'lib/unit/models/card/card.rb', line 133

def update_business_virtual_debit_card(card_id:, address: nil, phone: nil, email: nil, tags: nil, limits: nil)
  request = PatchBusinessVirtualCardRequest.new(card_id, address, phone, email, tags, limits)
  Unit::Resource::CardResource.update(request)
end