Sha256: 15de836a1dac53c837d090c2cbae0c8bcb7847428c72e9b1c4a37bd49e386c29

Contents?: true

Size: 683 Bytes

Versions: 16

Compression:

Stored size: 683 Bytes

Contents

# frozen_string_literal: true

module EgovUtils
  module Iszr
    module Addresses
      class FetchForLegalPerson
        class FromSampleData < ActiveInteraction::Base
          string :remote_id

          def execute
            attrs = sample_results.detect do |address|
              address['remote_id'] == remote_id
            end

            EgovUtils::Address.new(attrs.except('remote_id'))
          end

          private

          def sample_results
            results = File.read(
              EgovUtils::Engine.root.join('lib/egov_utils/iszr/lp_addresses.json')
            )

            JSON.parse(results)
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
egov_utils-1.5.0.alpha16 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha15 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha14 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha13 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha12 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha11 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha10 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha9 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha8 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha7 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha6 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha5 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha4 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha3 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha2 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb
egov_utils-1.5.0.alpha1 app/services/egov_utils/iszr/addresses/fetch_for_legal_person/from_sample_data.rb