Sha256: ef1cb680a607ad21d8737a80df7edae120cf58ec8309ec8d0ae49c40a0b33d40

Contents?: true

Size: 806 Bytes

Versions: 10

Compression:

Stored size: 806 Bytes

Contents

# frozen_string_literal: true

module EgovUtils
  module Iszr
    module LegalPeople
      class SearchByRemoteId < ActiveInteraction::Base
        MAPPING_CLASS = EgovUtils::Services::Iszr::LegalPeople

        string :remote_id

        def execute
          find_person
        end

        private

        def find_person
          initialize_person.find do |person|
            person.remote_id == remote_id
          end
        end

        def sample_results
          EgovUtils::Engine.root.join('lib/egov_utils/iszr/lp_results.json')
        end

        def initialize_person
          response = File.read(sample_results)

          body = JSON.parse(response)

          body.map do
            MAPPING_CLASS.new(_1.deep_symbolize_keys!)
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
egov_utils-1.5.0.alpha10 app/services/egov_utils/iszr/legal_people/search_by_remote_id.rb
egov_utils-1.5.0.alpha9 app/services/egov_utils/iszr/legal_people/search_by_remote_id.rb
egov_utils-1.5.0.alpha8 app/services/egov_utils/iszr/legal_people/search_by_remote_id.rb
egov_utils-1.5.0.alpha7 app/services/egov_utils/iszr/legal_people/search_by_remote_id.rb
egov_utils-1.5.0.alpha6 app/services/egov_utils/iszr/legal_people/search_by_remote_id.rb
egov_utils-1.5.0.alpha5 app/services/egov_utils/iszr/legal_people/search_by_remote_id.rb
egov_utils-1.5.0.alpha4 app/services/egov_utils/iszr/legal_people/search_by_remote_id.rb
egov_utils-1.5.0.alpha3 app/services/egov_utils/iszr/legal_people/search_by_remote_id.rb
egov_utils-1.5.0.alpha2 app/services/egov_utils/iszr/legal_people/search_by_remote_id.rb
egov_utils-1.5.0.alpha1 app/services/egov_utils/iszr/legal_people/search_by_remote_id.rb