Sha256: c0ebcbce62281d03bb7fd616948d10c2f3fbc9346278f46bfa79fcc699d5a379

Contents?: true

Size: 1.91 KB

Versions: 1

Compression:

Stored size: 1.91 KB

Contents

=begin
                  Arachni-RPC
  Copyright (c) 2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>

  This is free software; you can copy and distribute and modify
  this program under the term of the GPL v2.0 License
  (See LICENSE file for details)

=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 lib/arachni/rpc/request.rb