class MundipaggClient::Operations::CreditCards::Update

Public Instance Methods

execute() click to toggle source
# File lib/mundipagg_client/operations/credit_cards/update.rb, line 18
def execute
  # binding.pry
  raise "Invalid Mundipagg operation" unless request.success?

  JSON.parse(request.body)
end

Private Instance Methods

credit_card_params() click to toggle source
# File lib/mundipagg_client/operations/credit_cards/update.rb, line 33
def credit_card_params
  {
    exp_month: params[:exp_month],
    exp_year: params[:exp_year],
    holder_name: sanitize_names(params[:holder_name]),
    holder_document: sanitize_numbers(params[:holder_document])
  }
end
request() click to toggle source
# File lib/mundipagg_client/operations/credit_cards/update.rb, line 27
def request
  @request ||= connection.put("#{BASE_URL}/customers/#{customer_id}/cards/#{card_id}") do |req|
    req.body = credit_card_params.to_json
  end
end