Class: Buffet::ProxyInterface
- Inherits:
-
Object
- Object
- Buffet::ProxyInterface
- Defined in:
- lib/buffet.rb
Overview
#########################################################
The ProxyInterface class defines the interface for the proxy implementations, raising errors if a method is undefined. eg:
def find_album(user, = {})
raise "find_album not implemented"
end
The proxy implementations override these methods, preventing the errors from being raised. Proxy methods are translating from the syntax of pure-type methods to the syntax of API access. They're breaking object-based method calls out into endpoint-based method calls... but still in a generic way. Then it's up to the individual proxies to translate the generic API call to the proper service-specific endpoint.
Proxies should implement finder methods for each attribute on a pure type. Eg, if an image has created_at and caption fields, the consumer should be able to call Image.find(user, => "sally fields") and the proxy should implement the find_by_caption method. Now, it may not be feasible to search on every single attribute - but that's the level of granularity we want to use for these methods.
Proxy methods should be able to take an option Hydra object in which to queue its request. If no hydra is provided, the proxy method should create its own HTTP connection. All request multithreading should happen at the pure-type level.