Sha256: 8b96a8cd9c6ba0da152dd40d57e2e807c1ab484d869fe3e4746f88f510b5fe5f

Contents?: true

Size: 591 Bytes

Versions: 2

Compression:

Stored size: 591 Bytes

Contents

# frozen_string_literal: true

require 'companies_house_hub/base_model'

module CompaniesHouseHub
  class Address < BaseModel
    attr_reader :address_line1, :address_line2, :postal_code, :locality, :country

    def initialize(json = {})
      p json
      @address_line1 = json.dig(:address_line_1)
      @address_line2 = json.dig(:address_line_2)
      @country = json.dig(:country)
      @postal_code = json.dig(:postal_code)
      @locality = json.dig(:locality)
    end

    def full
      [@address_line1, @address_line2, @locality, @postal_code].compact.join(', ')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
companies_house_hub-0.0.15 lib/companies_house_hub/models/address.rb
companies_house_hub-0.0.14 lib/companies_house_hub/models/address.rb