Parent

Class Index [+]

Quicksearch

MCollective::RPC::Request

Simple class to manage compliant requests for MCollective::RPC agents

Attributes

time[RW]

(Not documented)

action[RW]

(Not documented)

data[RW]

(Not documented)

sender[RW]

(Not documented)

agent[RW]

(Not documented)

uniqid[RW]

(Not documented)

caller[RW]

(Not documented)

ddl[RW]

(Not documented)

Public Class Methods

new(msg, ddl) click to toggle source

(Not documented)

    # File lib/mcollective/rpc/request.rb, line 7
 7:       def initialize(msg, ddl)
 8:         @time = msg[:msgtime]
 9:         @action = msg[:body][:action]
10:         @data = msg[:body][:data]
11:         @sender = msg[:senderid]
12:         @agent = msg[:body][:agent]
13:         @uniqid = msg[:requestid]
14:         @caller = msg[:callerid] || "unknown"
15:         @ddl = ddl
16:       end

Public Instance Methods

[](key) click to toggle source

If data is a hash, gives easy access to its members, else returns nil

    # File lib/mcollective/rpc/request.rb, line 34
34:       def [](key)
35:         return nil unless @data.is_a?(Hash)
36:         return @data[key]
37:       end
fetch(key, default) click to toggle source

(Not documented)

    # File lib/mcollective/rpc/request.rb, line 39
39:       def fetch(key, default)
40:         return nil unless @data.is_a?(Hash)
41:         return @data.fetch(key, default)
42:       end
include?(key) click to toggle source

If data is a hash, quick helper to get access to it’s include? method else returns false

    # File lib/mcollective/rpc/request.rb, line 20
20:       def include?(key)
21:         return false unless @data.is_a?(Hash)
22:         return @data.include?(key)
23:       end
should_respond?() click to toggle source

If no :process_results is specified always respond else respond based on the supplied property

    # File lib/mcollective/rpc/request.rb, line 27
27:       def should_respond?
28:         return @data[:process_results] if @data.include?(:process_results)
29: 
30:         return true
31:       end
to_hash() click to toggle source

(Not documented)

    # File lib/mcollective/rpc/request.rb, line 44
44:       def to_hash
45:         return {:agent => @agent,
46:                 :action => @action,
47:                 :data => @data}
48:       end
to_json() click to toggle source

(Not documented)

    # File lib/mcollective/rpc/request.rb, line 55
55:       def to_json
56:         to_hash.merge!({:sender   => @sender,
57:                         :callerid => @callerid,
58:                         :uniqid   => @uniqid}).to_json
59:       end
validate!() click to toggle source

Validate the request against the DDL

    # File lib/mcollective/rpc/request.rb, line 51
51:       def validate!
52:         @ddl.validate_rpc_request(@action, @data)
53:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.