Simple class to manage compliant requests for MCollective::RPC agents
(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
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
(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
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
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
(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
(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 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.
Generated with the Darkfish Rdoc Generator 1.1.6.