Sha256: 3b90647d3c8b776739ed92ea3d18f9f72d5db3e907359eb62ddd20abb0e3aa88

Contents?: true

Size: 646 Bytes

Versions: 3

Compression:

Stored size: 646 Bytes

Contents

# frozen_string_literal: true

require 'credit_gateway/base_model'
require 'credit_gateway/rating'
require 'credit_gateway/rating_status'
require 'credit_gateway/rating_component'

module CreditGateway
  class Score < BaseModel
    attributes :id, :company_id, :status, :rating, :components

    def self.build(json:)
      super.tap do |record|
        record.status = RatingStatus.build(json: (record.status || {}))
        record.rating = Rating.build(json: (record.rating || {}))
        record.components = (record.components || []).map do |component|
          RatingComponent.build(json: component)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
credit_gateway-0.3.2 lib/credit_gateway/score.rb
credit_gateway-0.3.1 lib/credit_gateway/score.rb
credit_gateway-0.3.0 lib/credit_gateway/score.rb