X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=doc%2Fclasses%2FMCollective%2FRPC%2FRequest.html;fp=doc%2Fclasses%2FMCollective%2FRPC%2FRequest.html;h=e182884cebd90002308f12ef833d145d6c6c2d77;hb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;hp=0000000000000000000000000000000000000000;hpb=8a3fe7daeecccf43dd71c59371c5005400d35101;p=packages%2Fprecise%2Fmcollective.git diff --git a/doc/classes/MCollective/RPC/Request.html b/doc/classes/MCollective/RPC/Request.html new file mode 100644 index 0000000..e182884 --- /dev/null +++ b/doc/classes/MCollective/RPC/Request.html @@ -0,0 +1,401 @@ + + + + +
+Class | +MCollective::RPC::Request | +
In: | +
+
+ lib/mcollective/rpc/request.rb
+
+ + |
+
Parent: | ++ Object + | +
+Simple class to manage compliant requests for MCollective::RPC agents +
+ +action | +[RW] | ++ |
agent | +[RW] | ++ |
caller | +[RW] | ++ |
data | +[RW] | ++ |
ddl | +[RW] | ++ |
sender | +[RW] | ++ |
time | +[RW] | ++ |
uniqid | +[RW] | ++ |
+ # 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 ++
+ # 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 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 ++
+ # File lib/mcollective/rpc/request.rb, line 44 +44: def to_hash +45: return {:agent => @agent, +46: :action => @action, +47: :data => @data} +48: end ++
+ # 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 ++