Sha256: 3c448d663eb3bd10beb89d0a2b3968aab4b3e0630db659a851202230e7fd0c9f
Contents?: true
Size: 889 Bytes
Versions: 16
Compression:
Stored size: 889 Bytes
Contents
module EgovUtils module Iszr module LegalPeople class DevSearch < ActiveInteraction::Base string :ico validates :ico, presence: true MAPPING_CLASS = EgovUtils::Services::Iszr::LegalPeople def execute legal_person = initialize_person.detect { |person| person.ico == ico } if legal_person.nil? errors.add(:base, I18n.t('errors.messages.legal_person.not_found')) else legal_person end end private 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
16 entries across 16 versions & 1 rubygems