Sha256: 86218238f6f12bf499c004b2df8709059dcfe3c686a32f3fcd7218de98b6b1cd

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 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

5 entries across 5 versions & 1 rubygems

Version Path
creditsafe_connect-0.1.7 lib/creditsafe/models/report.rb
creditsafe_connect-0.1.6 lib/creditsafe/models/report.rb
creditsafe_connect-0.1.5 lib/creditsafe/models/report.rb
creditsafe_connect-0.1.4 lib/creditsafe/models/report.rb
creditsafe_connect-0.1.3 lib/creditsafe/models/report.rb