Sha256: c59e2caed1e02c35621c573d12770c74e67889ec232b87b3daa21a370668456a

Contents?: true

Size: 1017 Bytes

Versions: 7

Compression:

Stored size: 1017 Bytes

Contents

# frozen_string_literal: true

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

module Creditsafe
  module Models
    class CompanySummary < BaseModel
      attributes :business_name, :country, :company_number, :company_registration_number,
                 :main_activity, :company_status, :latest_shareholders_equity_figure, :credit_rating

      def self.build(json:)
        super.tap do |record|
          record.main_activity = MainActivity.build(json: json.fetch(:mainActivity, {}))
          record.company_status = CompanyStatus.build(json: json.fetch(:companyStatus, {}))
          record.latest_shareholders_equity_figure = CurrencyValue.build(
            json: json.fetch(:latestShareholdersEquityFigure, {})
          )
          record.credit_rating = CreditRating.build(json: json.fetch(:creditRating, {}))
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
creditsafe_connect-0.1.6 lib/creditsafe/models/company_summary.rb
creditsafe_connect-0.1.5 lib/creditsafe/models/company_summary.rb
creditsafe_connect-0.1.4 lib/creditsafe/models/company_summary.rb
creditsafe_connect-0.1.3 lib/creditsafe/models/company_summary.rb
creditsafe_connect-0.1.2 lib/creditsafe/models/company_summary.rb
creditsafe_connect-0.1.1 lib/creditsafe/models/company_summary.rb
creditsafe_connect-0.1.0 lib/creditsafe/models/company_summary.rb