Class: BGS::People::Request

Inherits:
Common::RedisStore show all
Includes:
Common::CacheAside
Defined in:
app/services/bgs/people/request.rb

Constant Summary collapse

REDIS_CONFIG_KEY =
:bgs_find_person_by_participant_id_response

Constants inherited from Common::RedisStore

Common::RedisStore::REQ_CLASS_INSTANCE_VARS

Instance Method Summary collapse

Methods included from Common::CacheAside

#cache, #cached?, #do_cached_with, #set_attributes

Methods inherited from Common::RedisStore

create, delete, #destroy, #destroyed?, exists?, #expire, find, find_or_build, #initialize, #initialize_dup, keys, #persisted?, pop, redis_key, redis_store, redis_ttl, #save, #save!, #ttl, #update, #update!

Constructor Details

This class inherits a constructor from Common::RedisStore

Instance Method Details

#find_person_by_participant_id(user:) ⇒ Object



14
15
16
# File 'app/services/bgs/people/request.rb', line 14

def find_person_by_participant_id(user:)
  find_person_by_participant_id_cached_response(user)
end

#find_person_by_participant_id_cached_response(user) ⇒ Object (private)



20
21
22
23
24
25
26
27
28
# File 'app/services/bgs/people/request.rb', line 20

def find_person_by_participant_id_cached_response(user)
  user_key = user.participant_id

  return BGS::People::Response.new(nil, status: :no_id) unless user_key

  do_cached_with(key: user_key) do
    BGS::People::Service.new(user).find_person_by_participant_id
  end
end