# frozen_string_literal: true require 'creditsafe/base_model' require 'creditsafe/models/legal_form' require 'creditsafe/models/company_status' require 'creditsafe/models/main_activity' require 'creditsafe/models/address' module Creditsafe module Models class BasicInformation < BaseModel attributes :business_name, :registered_company_name, :company_registration_number, :country, :vat_registration_number, :legal_form, :company_registration_date, :operations_start_date, :company_status, :principal_activity, :contact_address def self.build(json:) super.tap do |record| record.legal_form = LegalForm.build(json: json.fetch(:legalForm, {})) record.company_status = CompanyStatus.build(json: json.fetch(:companyStatus, {})) record.principal_activity = MainActivity.build(json: json.fetch(:principalActivity, {})) record.contact_address = Address.build(json: json.fetch(:contactAddress, {})) end end end end end