Class: GIDSRedis
- Inherits:
-
Common::RedisStore
- Object
- Common::RedisStore
- GIDSRedis
- Includes:
- Common::CacheAside
- Defined in:
- app/models/gids_redis.rb
Overview
Facade for GIDS.
Constant Summary
Constants inherited from Common::RedisStore
Common::RedisStore::REQ_CLASS_INSTANCE_VARS
Instance Attribute Summary collapse
-
#rest_call ⇒ Symbol
The GI::Client method to call.
-
#scrubbed_params ⇒ Hash
The params to be used with the rest_call.
Instance Method Summary collapse
- #method_missing(name, *args) ⇒ Object
- #respond_to_missing?(name, _include_private) ⇒ Boolean
- #search_respond_to?(name) ⇒ Boolean
Methods included from Common::CacheAside
#cache, #cached?, #do_cached_with
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
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/models/gids_redis.rb', line 19 def method_missing(name, *args) self.rest_call = name self.scrubbed_params = args.first if respond_to?(name) response_from_redis_or_service(gi_service).body elsif search_respond_to?(name) response_from_redis_or_service(gi_search_service).body else super end end |
Instance Attribute Details
#rest_call ⇒ Symbol
Returns the GI::Client method to call.
14 15 16 |
# File 'app/models/gids_redis.rb', line 14 def rest_call @rest_call end |
#scrubbed_params ⇒ Hash
Returns the params to be used with the rest_call.
17 18 19 |
# File 'app/models/gids_redis.rb', line 17 def scrubbed_params @scrubbed_params end |
Instance Method Details
#respond_to_missing?(name, _include_private) ⇒ Boolean
32 33 34 |
# File 'app/models/gids_redis.rb', line 32 def respond_to_missing?(name, _include_private) gi_service.respond_to?(name) end |
#search_respond_to?(name) ⇒ Boolean
36 37 38 |
# File 'app/models/gids_redis.rb', line 36 def search_respond_to?(name) gi_search_service.respond_to?(name) end |