Sha256: 2387f792c526dc1e601ac2f375a5d2e852ec10ec66fc8357d21f62c421e52da8
Contents?: true
Size: 1 KB
Versions: 10
Compression:
Stored size: 1 KB
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 if Rails.env.production? find_remote_person else find_local_person end end private def find_remote_person EgovUtils::Iszr::FindPersonByAifo.run!(remote_id:) end def find_local_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
10 entries across 10 versions & 1 rubygems