Sha256: 0539ba93e5de55bdb177379f72459f165f2bc5722d7d98ee621353656a02eaf7
Contents?: true
Size: 664 Bytes
Versions: 5
Compression:
Stored size: 664 Bytes
Contents
class Response def initialize @details = [] @url = nil @state = 'bad' @additional_vars = [] end def add_var hash @additional_vars << hash end def add_detail detail @details << detail end def set_url url @url = url end def details? @details.any? end def set_state state @state = state end def error_state _error set_state 'shit' add_detail _error.message end def get if @state == 'bad' set_state 'ok' unless details? end result = {state: @state, details: @details, url: @url} @additional_vars.each do |h| result.merge! h end result end end
Version data entries
5 entries across 5 versions & 1 rubygems