Sha256: da72ddfb16aff48dcff86fb3808c21b490043f20bb57b0d2b211681eee0a299d

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

require 'time'
require 'truelayer/base_model'
require 'truelayer/account_number'

module Truelayer
  class Account < BaseModel
    attributes :update_timestamp, :account_id, :account_type, :display_name,
      :currency, :account_number, :provider, :provider_id

    def self.build(json:)
      super.tap do |record|
        record.account_number = AccountNumber.build(json: (record.account_number || {}))
        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

1 entries across 1 versions & 1 rubygems

Version Path
truelayer-0.1.0 lib/truelayer/account.rb