Sha256: 5246e8ef50ff838047243738183c6b2423371a2291b98dd0a83a406f6bc75314

Contents?: true

Size: 588 Bytes

Versions: 11

Compression:

Stored size: 588 Bytes

Contents

###
# XResponse
# A standard response class suitable for Ext.Direct AJAX responses.
# @author Chris Scott
#
class XResponse
    attr_accessor :type, :status, :errors, :success, :message, :result
    attr_reader :tid

    def initialize(req)
        @tid    = req.tid
        @type   = req.type
        @status = false
        @message = ''
        @result = []
        @errors = []
    end

    def to_h
        {:tid => @tid, :status => @status, :type => @type, :message => @message, :result => @result, :errors => @errors}
    end

    def to_json
        self.to_h.to_json
    end
end

Version data entries

11 entries across 11 versions & 6 rubygems

Version Path
christocracy-christocracy-merb-extjs-direct-0.0.1 lib/merb-extjs-direct/xresponse.rb
christocracy-christocracy-merb-extjs-direct-0.0.2 lib/merb-extjs-direct/xresponse.rb
christocracy-merb-extjs-direct-0.0.1 lib/merb-ext-direct/xresponse.rb
extjs-direct-0.0.1 lib/merb-extjs-direct/xresponse.rb
merb-extjs-direct-0.0.3 lib/merb-extjs-direct/xresponse.rb
merb-extjs-direct-0.0.2 lib/merb-extjs-direct/xresponse.rb
merb-ext-direct-0.0.1 lib/merb-ext-direct/xresponse.rb
merb-extjs-direct-0.0.4 lib/merb-extjs-direct/xresponse.rb
rails-extjs-direct-0.0.3 lib/rails-extjs-direct/xresponse.rb
rails-extjs-direct-0.0.2 lib/rails-extjs-direct/xresponse.rb
rails-extjs-direct-0.0.1 lib/rails-extjs-direct/xresponse.rb