class WebFetch::Retriever
Retrieves a gathered HTTP request
Public Class Methods
new(storage, params, options)
click to toggle source
# File lib/web_fetch/retriever.rb, line 8 def initialize(storage, params, options) @uid = params[:uid] @hash = params[:hash] @storage = storage @block = options.fetch(:block, true) end
Public Instance Methods
find()
click to toggle source
# File lib/web_fetch/retriever.rb, line 15 def find request = @storage.fetch(@uid) unless @uid.nil? return pending if request.nil? request end
Private Instance Methods
pending()
click to toggle source
# File lib/web_fetch/retriever.rb, line 29 def pending { uid: @uid, pending: true } end
validate()
click to toggle source
# File lib/web_fetch/retriever.rb, line 24 def validate error(:hash_or_uid_but_not_both) if !@uid.nil? && !@hash.nil? error(:missing_hash_and_uid) if @uid.nil? && @hash.nil? end