Class: MercadoPago::CustomCheckout::CardToken

Inherits:
Resource
  • Object
show all
Defined in:
lib/mercadopago/custom_checkout/card_token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#inspect

Constructor Details

#initialize(client, id:, **extras) ⇒ CardToken

Returns a new instance of CardToken.



6
7
8
9
10
# File 'lib/mercadopago/custom_checkout/card_token.rb', line 6

def initialize(client, id:, **extras)
  @client = client
  @id = id
  process_hash(extras) if extras
end

Instance Attribute Details

#card_idObject (readonly)

Returns the value of attribute card_id.



4
5
6
# File 'lib/mercadopago/custom_checkout/card_token.rb', line 4

def card_id
  @card_id
end

#cardholderObject (readonly)

Returns the value of attribute cardholder.



4
5
6
# File 'lib/mercadopago/custom_checkout/card_token.rb', line 4

def cardholder
  @cardholder
end

#extrasObject (readonly)

Returns the value of attribute extras.



4
5
6
# File 'lib/mercadopago/custom_checkout/card_token.rb', line 4

def extras
  @extras
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/mercadopago/custom_checkout/card_token.rb', line 4

def id
  @id
end

#last_digitsObject (readonly)

Returns the value of attribute last_digits.



4
5
6
# File 'lib/mercadopago/custom_checkout/card_token.rb', line 4

def last_digits
  @last_digits
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/mercadopago/custom_checkout/card_token.rb', line 4

def status
  @status
end

Instance Method Details

#create(payload) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/mercadopago/custom_checkout/card_token.rb', line 12

def create(payload)
  response = @client.call(:card_tokens, :create, payload)
  if response.key?(:error)
    response
  else
    process_hash(response)
    self
  end
end

#retrieveObject



22
23
24
25
26
27
28
29
30
# File 'lib/mercadopago/custom_checkout/card_token.rb', line 22

def retrieve
  response = @client.call(:card_tokens, :retrieve, { id: id })
  if response.key?(:error)
    response
  else
    process_hash(response)
    self
  end
end

#update(payload) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/mercadopago/custom_checkout/card_token.rb', line 32

def update(payload)
  response = @client.call(:card_tokens, :update, payload)
  if response.key?(:error)
    response
  else
    process_hash(response)
    self
  end
end