class ConektaMotion::Token

Attributes

error[R]
token_id[R]

Public Class Methods

init_from(response) click to toggle source
# File lib/conekta-motion/token.rb, line 15
def init_from(response)
  token_id = nil
  error = nil

  if response
    token_id = response[:id] if response[:object] == 'token'
    error = response[:message_to_purchaser] if response[:object] == 'error'
  end

  Token.new token_id, error
end
new(token_id, error) click to toggle source
# File lib/conekta-motion/token.rb, line 5
def initialize(token_id, error)
  @token_id = token_id
  @error = error
end

Public Instance Methods

valid?() click to toggle source
# File lib/conekta-motion/token.rb, line 10
def valid?
  error.nil?
end