Sha256: 9198f98d63e3a86ebb9a535df2fe1f83b382341cb04f172635e0ca3ba5d06c4a
Contents?: true
Size: 777 Bytes
Versions: 1
Compression:
Stored size: 777 Bytes
Contents
# frozen_string_literal: true module Bs2Api module Entities class Error attr_accessor :code, :description def initialize(args = {}) @code = args.fetch(:code, nil) @description = args.fetch(:description, nil) end def to_hash hash_data = { "erroCodigo": @code, "erroDescricao": @description } ActiveSupport::HashWithIndifferentAccess.new(hash_data) end def self.from_response(hash_payload) return {} if hash_payload.blank? hash = ActiveSupport::HashWithIndifferentAccess.new(hash_payload) Bs2Api::Entities::Error.new( code: hash['erroCodigo'], description: hash['erroDescricao'] ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bs2_api-1.9.0 | lib/bs2_api/entities/error.rb |