Sha256: 7b450835ea31ddde2ebb6c5ee718cc9ec739c3ffeaeaaebf31117371f3078cf3

Contents?: true

Size: 661 Bytes

Versions: 2

Compression:

Stored size: 661 Bytes

Contents

# frozen_string_literal: true

require 'time'
require 'credit_gateway/base_model'
require 'credit_gateway/rating'

module CreditGateway
  class FullScore < BaseModel
    attributes :frequency, :calculated, :full_score, :behavioral_score, :financial_score

    def self.build(json:)
      super.tap do |record|
        record.full_score = Rating.build(json: (record.full_score || {}))
        record.behavioral_score = Rating.build(json: (record.behavioral_score || {}))
        record.financial_score = Rating.build(json: (record.financial_score || {}))
        record.calculated = Time.parse(record.calculated) if record.calculated
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
credit_gateway-0.1.1 lib/credit_gateway/full_score.rb
credit_gateway-0.1.0 lib/credit_gateway/full_score.rb