Sha256: 18f33ef8531e961c64afbec7c3f22a9088826950b08ab6199bfd385e4dff4a0f
Contents?: true
Size: 801 Bytes
Versions: 20
Compression:
Stored size: 801 Bytes
Contents
# frozen_string_literal: true module Bs2Api module Entities class PixKey attr_accessor :key, :type TYPES = { cpf: 'CPF', cnpj: 'CNPJ', phone: 'PHONE', email: 'EMAIL', random: 'EVP' } def initialize(args = {}) @key = args.fetch(:key, nil) @type = args.fetch(:type, 'CPF') end def to_hash ActiveSupport::HashWithIndifferentAccess.new( { "valor": @key, "tipo": @type } ) end def self.from_response(hash_payload) hash = ActiveSupport::HashWithIndifferentAccess.new(hash_payload) Bs2Api::Entities::PixKey.new( key: hash["valor"], type: hash["tipo"] ) end end end end
Version data entries
20 entries across 20 versions & 1 rubygems