Sha256: 00d9e27163add53593506d1f71f8561bb2b3eef12305799ed40286461a3a9be7

Contents?: true

Size: 1.87 KB

Versions: 1

Compression:

Stored size: 1.87 KB

Contents

=begin

    This file is part of the Arachni-RPC project and may be subject to
    redistribution and commercial restrictions. Please see the Arachni-RPC
    web site for more information on licensing and terms of use.

=end

require File.join( File.expand_path( File.dirname( __FILE__ ) ), '../', 'rpc' )

module Arachni
module RPC

#
# Represents an RPC request.
#
# It's here only for formalization purposes,
# it's not actually sent over the wire.
#
# What is sent is a hash generated by {#prepare_for_tx}.
# which is in the form of:
#
#
#    {
#        'message'     => msg, # RPC message in the form of 'handler.method'
#        'args'        => args, # optional array of arguments for the remote method
#        'token'       => token, # optional authentication token
#    }
#
# Any client that has SSL support and can serialize a Hash
# just like the one above can communicate with the RPC server.
#
# @author: Tasos "Zapotek" Laskos
#                                      <tasos.laskos@gmail.com>
#                                      <zapotek@segfault.gr>
# @version: 0.1
#
class Request < Message

    #
    # RPC message in the form of 'handler.method'.
    #
    # @return   [String]
    #
    attr_accessor :message

    #
    # Optional array of arguments for the remote method.
    #
    # @return   [Array]
    #
    attr_accessor :args

    #
    # Optional authentication token.
    #
    # @return   [String]
    #
    attr_accessor :token

    #
    # Callback to be invoked on the response.
    #
    # @return   [Proc]
    #
    attr_accessor :callback

    # @see Message#initialize
    def initialize( * )
        super
    end

    def do_not_defer!
        @defer = false
    end

    def defer?
        @defer.nil? ? true : @defer
    end

    private

    def transmit?( attr )
        ![
            :@defer,
            :@callback
        ].include?( attr )
    end

end

end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
arachni-rpc-0.1.1 lib/arachni/rpc/request.rb