Sha256: 4f1ae2007f014399b6e16f3558658eb3ac6c9019131ea508d3371247e36c4b3f
Contents?: true
Size: 940 Bytes
Versions: 15
Compression:
Stored size: 940 Bytes
Contents
# frozen_string_literal: true module Bs2Api module Entities class Bank attr_accessor :ispb, :account, :customer def initialize(args = {}) @ispb = args.fetch(:ispb, nil) @account = args.fetch(:account, nil) @customer = args.fetch(:customer, nil) end def to_hash ActiveSupport::HashWithIndifferentAccess.new( { "ispb": @ispb, "conta": @account.to_hash, "pessoa": @customer.to_hash } ) end def self.from_response(hash_payload) return if hash_payload.blank? hash = ActiveSupport::HashWithIndifferentAccess.new(hash_payload) Bs2Api::Entities::Bank.new( ispb: hash["ispb"], account: Bs2Api::Entities::Account.from_response(hash["conta"]), customer: Bs2Api::Entities::Customer.from_response(hash["pessoa"]) ) end end end end
Version data entries
15 entries across 15 versions & 1 rubygems