Sha256: c4f7860ad341c43fc7f86587a280b8f760549e66b045216d29c8336b74cf1e23

Contents?: true

Size: 768 Bytes

Versions: 3

Compression:

Stored size: 768 Bytes

Contents

# frozen_string_literal: true

require 'creditsafe/base_model'
require 'creditsafe/models/credit_rating'
require 'creditsafe/models/currency_value'

module Creditsafe
  module Models
    class CreditScore < BaseModel
      attributes :current_credit_rating, :current_contract_limit,
                 :previous_credit_rating, :latest_rating_change_date

      def self.build(json:)
        super.tap do |record|
          record.current_credit_rating = CreditRating.build(json: json.fetch(:currentCreditRating, {}))
          record.current_contract_limit = CurrencyValue.build(json: json.fetch(:currentContractLimit, {}))
          record.previous_credit_rating = CreditRating.build(json: json.fetch(:previousCreditRating, {}))
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
creditsafe_connect-0.1.2 lib/creditsafe/models/credit_score.rb
creditsafe_connect-0.1.1 lib/creditsafe/models/credit_score.rb
creditsafe_connect-0.1.0 lib/creditsafe/models/credit_score.rb