Sha256: ac8a8f6074ddd792bd685206ba3cc2cdc5a78835dd252072565691e00a11794e

Contents?: true

Size: 608 Bytes

Versions: 4

Compression:

Stored size: 608 Bytes

Contents

# 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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
truelayer-0.1.4 lib/truelayer/card.rb
truelayer-0.1.3 lib/truelayer/card.rb
truelayer-0.1.2 lib/truelayer/card.rb
truelayer-0.1.1 lib/truelayer/card.rb