Sha256: 4a51e5b70299bac3938b7774ffff2ad683206756f6587a374ab12d8e086f4781
Contents?: true
Size: 1019 Bytes
Versions: 5
Compression:
Stored size: 1019 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 if Rails.env.production? find_remote_person else find_local_person end end private def find_remote_person EgovUtils::Iszr::FindPersonByIco.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/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
5 entries across 5 versions & 1 rubygems