Class: Endpointer::ResourceExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/endpointer/resource_executor.rb

Instance Method Summary collapse

Instance Method Details

#perform(request, resource, options) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/endpointer/resource_executor.rb', line 7

def perform(request, resource, options)
  begin
    cache(options.cache_dir).get(resource)
  rescue Endpointer::Errors::CachedItemNotFoundError
    response = Endpointer::PerformerFactory.create(resource.method).execute(request, resource)
    cache(options.cache_dir).set(resource, response)
    response
  end
end