Sha256: 63bc051d3d8190739ea62efa1b4accb71e7d1146208a1e5a54bf0414df418c42

Contents?: true

Size: 538 Bytes

Versions: 8

Compression:

Stored size: 538 Bytes

Contents

# frozen_string_literal: true

require 'creditsafe/base_model'
require 'creditsafe/models/address'

module Creditsafe
  module Models
    class ContactInformation < BaseModel
      attributes :main_address, :other_addresses

      def self.build(json:)
        super.tap do |record|
          record.main_address = Address.build(json: json.fetch(:mainAddress, {}))
          record.other_addresses = json.fetch(:otherAddresses, []).map do |addr|
            Address.build(json: addr)
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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