Sha256: 51641b22a48e2a3d20becab40e48403e369814a8e7977e2576b5f5388096d9a5

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

require 'creditsafe/base_model'
require 'creditsafe/models/company_summary'
require 'creditsafe/models/company_identification'
require 'creditsafe/models/credit_score'
require 'creditsafe/models/contact_information'

module Creditsafe
  module Models
    class Report < BaseModel
      attributes :company_id, :language,
                 :company_summary, :company_identification, :credit_score,
                 :contact_information,
                 :share_capital_structure, :directors, :directorships,
                 :financial_statements, :local_financial_statements,
                 :payment_data, :payment_data_extra,
                 :negative_information, :additional_information,
                 :other_information

      def self.build(json:)
        super.tap do |record|
          record.company_summary = CompanySummary.build(json: json.fetch(:companySummary, {}))
          record.company_identification = CompanyIdentification.build(
            json: json.fetch(:companyIdentification, {})
          )
          record.credit_score = CreditScore.build(json: json.fetch(:creditScore, {}))
          record.contact_information = ContactInformation.build(json: json.fetch(:contactInformation, {}))
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
creditsafe_connect-0.1.2 lib/creditsafe/models/report.rb