lib/loquor/api_calls/show.rb in loquor-1.4.0 vs lib/loquor/api_calls/show.rb in loquor-1.5.0
- old
+ new
@@ -5,14 +5,24 @@
super(klass)
@id = id
end
def execute
- obj = if (klass.cache)
- Loquor.get("#{klass.path}/#{@id}", cache=klass.cache)
- else
- Loquor.get("#{klass.path}/#{@id}")
+ begin
+ get_data
+ rescue RestClient::ResourceNotFound
+ if Loquor.config.retry_404s
+ sleep(1)
+ get_data
+ else
+ raise
+ end
end
- @klass.new(obj)
+ end
+
+ private
+ def get_data
+ options = {cache: klass.cache}
+ klass.new Loquor.get("#{klass.path}/#{@id}", options)
end
end
end