# frozen_string_literal: true require 'time' require 'truelayer/base_model' module Truelayer class Card < BaseModel attributes :update_timestamp, :account_id, :card_type, :card_network, :partial_card_number, :name_on_card, :valid_from, :valid_to, :display_name, :currency, :provider, :provider_id def self.build(json:) super.tap do |record| record.update_timestamp = Time.parse(record.update_timestamp) if record.update_timestamp record.provider_id = record.provider[:provider_id] if record.provider end end end end