Class: Myrr::Card
- Inherits:
-
Object
- Object
- Myrr::Card
- Defined in:
- lib/myrr/card.rb
Overview
Virtual card issued to a wallet.
Card numbers, expiry, and CVC are returned ONLY at creation time. Subsequent lookups return last4 only.
Instance Attribute Summary collapse
-
#brand ⇒ Object
readonly
Returns the value of attribute brand.
-
#controls ⇒ Object
readonly
Returns the value of attribute controls.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#cvc ⇒ Object
readonly
Returns the value of attribute cvc.
-
#expiry ⇒ Object
readonly
Returns the value of attribute expiry.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last4 ⇒ Object
readonly
Returns the value of attribute last4.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#wallet_id ⇒ Object
readonly
Returns the value of attribute wallet_id.
Instance Method Summary collapse
-
#cancel! ⇒ Object
Permanently cancel this card.
-
#freeze! ⇒ Object
Freeze this card (no new authorizations).
-
#initialize(attrs) ⇒ Card
constructor
A new instance of Card.
-
#unfreeze! ⇒ Object
Unfreeze this card.
Constructor Details
#initialize(attrs) ⇒ Card
Returns a new instance of Card.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/myrr/card.rb', line 13 def initialize(attrs) @id = attrs["id"] @wallet_id = attrs["wallet_id"] @last4 = attrs["last4"] @brand = attrs["brand"] || "visa" @status = attrs["status"] @controls = attrs["controls"] @number = attrs["number"] @expiry = attrs["expiry"] @cvc = attrs["cvc"] @created_at = attrs["created_at"] @updated_at = attrs["updated_at"] end |
Instance Attribute Details
#brand ⇒ Object (readonly)
Returns the value of attribute brand.
9 10 11 |
# File 'lib/myrr/card.rb', line 9 def brand @brand end |
#controls ⇒ Object (readonly)
Returns the value of attribute controls.
9 10 11 |
# File 'lib/myrr/card.rb', line 9 def controls @controls end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
9 10 11 |
# File 'lib/myrr/card.rb', line 9 def created_at @created_at end |
#cvc ⇒ Object (readonly)
Returns the value of attribute cvc.
9 10 11 |
# File 'lib/myrr/card.rb', line 9 def cvc @cvc end |
#expiry ⇒ Object (readonly)
Returns the value of attribute expiry.
9 10 11 |
# File 'lib/myrr/card.rb', line 9 def expiry @expiry end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/myrr/card.rb', line 9 def id @id end |
#last4 ⇒ Object (readonly)
Returns the value of attribute last4.
9 10 11 |
# File 'lib/myrr/card.rb', line 9 def last4 @last4 end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
9 10 11 |
# File 'lib/myrr/card.rb', line 9 def number @number end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
9 10 11 |
# File 'lib/myrr/card.rb', line 9 def status @status end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
9 10 11 |
# File 'lib/myrr/card.rb', line 9 def updated_at @updated_at end |
#wallet_id ⇒ Object (readonly)
Returns the value of attribute wallet_id.
9 10 11 |
# File 'lib/myrr/card.rb', line 9 def wallet_id @wallet_id end |
Instance Method Details
#cancel! ⇒ Object
Permanently cancel this card.
42 43 44 45 46 |
# File 'lib/myrr/card.rb', line 42 def cancel! resp = client.delete("/v1/wallets/#{wallet_id}/cards/#{id}") @status = resp["status"] self end |
#freeze! ⇒ Object
Freeze this card (no new authorizations).
28 29 30 31 32 |
# File 'lib/myrr/card.rb', line 28 def freeze! resp = client.post("/v1/wallets/#{wallet_id}/cards/#{id}/freeze", {}) @status = resp["status"] self end |
#unfreeze! ⇒ Object
Unfreeze this card.
35 36 37 38 39 |
# File 'lib/myrr/card.rb', line 35 def unfreeze! resp = client.post("/v1/wallets/#{wallet_id}/cards/#{id}/unfreeze", {}) @status = resp["status"] self end |