Sha256: 436445f5277bfe15147b7df8429e93b1e50addba6e0cbfd1ff06f0b84d96e728

Contents?: true

Size: 810 Bytes

Versions: 6

Compression:

Stored size: 810 Bytes

Contents

# frozen_string_literal: true

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

        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/np_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

6 entries across 6 versions & 1 rubygems

Version Path
egov_utils-1.5.0.alpha6 app/services/egov_utils/iszr/natural_people/search_by_remote_id.rb
egov_utils-1.5.0.alpha5 app/services/egov_utils/iszr/natural_people/search_by_remote_id.rb
egov_utils-1.5.0.alpha4 app/services/egov_utils/iszr/natural_people/search_by_remote_id.rb
egov_utils-1.5.0.alpha3 app/services/egov_utils/iszr/natural_people/search_by_remote_id.rb
egov_utils-1.5.0.alpha2 app/services/egov_utils/iszr/natural_people/search_by_remote_id.rb
egov_utils-1.5.0.alpha1 app/services/egov_utils/iszr/natural_people/search_by_remote_id.rb