### Home Classes Methods

### In Files

- lib/mcollective/rpc/request.rb

### Parent

Object

### Methods

- ::new
- #[]
- #include?
- #should_respond?
- #to_hash
- #to_json

### Files

- COPYING
- README
- Rakefile
- PLACEHOLDER
- PLACEHOLDER

### Class/Module Index

Quicksearch

- MCollective
- MCollective::Agent
- MCollective::Agents
- MCollective::Aggregate
- MCollective::Aggregate::Base
- MCollective::Aggregate::Result
- MCollective::Aggregate::Result::Base
- MCollective::Aggregate::Result::CollectionResult
- MCollective::Aggregate::Result::NumericResult
- MCollective::Application
- MCollective::Applications
- MCollective::Client
- MCollective::Config
- MCollective::Connector
- MCollective::Connector::Base
- MCollective::DDL
- MCollective::DDLValidationError
- MCollective::Data
- MCollective::Data::Base
- MCollective::Data::Result
- MCollective::Discovery
- MCollective::Facts
- MCollective::Facts::Base
- MCollective::Generators
- MCollective::Generators::AgentGenerator
- MCollective::Generators::Base
- MCollective::Generators::DataGenerator
- MCollective::InvalidRPCData
- MCollective::Log
- MCollective::Logger
- MCollective::Logger::Base
- MCollective::Logger::Console_logger
- MCollective::Logger::File_logger
- MCollective::Logger::Syslog_logger
- MCollective::Matcher
- MCollective::Matcher::Parser
- MCollective::Matcher::Scanner
- MCollective::Message
- MCollective::MissingRPCData
- MCollective::MsgDoesNotMatchRequestID
- MCollective::MsgTTLExpired
- MCollective::NotTargettedAtUs
- MCollective::Optionparser
- MCollective::PluginManager
- MCollective::PluginPackager
- MCollective::PluginPackager::AgentDefinition
- MCollective::PluginPackager::StandardDefinition
- MCollective::RPC
- MCollective::RPC::ActionRunner
- MCollective::RPC::Agent
- MCollective::RPC::Audit
- MCollective::RPC::Client
- MCollective::RPC::Helpers
- MCollective::RPC::Progress
- MCollective::RPC::Reply
- MCollective::RPC::Request
- MCollective::RPC::Result
- MCollective::RPC::Stats
- MCollective::RPCAborted
- MCollective::RPCError
- MCollective::Registration
- MCollective::Registration::Base
- MCollective::Runner
- MCollective::RunnerStats
- MCollective::SSL
- MCollective::Security
- MCollective::Security::Base
- MCollective::SecurityValidationFailed
- MCollective::Shell
- MCollective::UnixDaemon
- MCollective::UnknownRPCAction
- MCollective::UnknownRPCError
- MCollective::Util
- MCollective::WindowsDaemon
- Array
- Dir
- Object
- String
- Symbol

No matching classes.

# MCollective::RPC::Request

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

### Attributes

action[RW]
agent[RW]
caller[RW]
data[RW]
sender[RW]
time[RW]
uniqid[RW]

### 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 33
    def [](key)
      return nil unless @data.is_a?(Hash)
      return @data[key]
    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 19
    def include?(key)
      return false unless @data.is_a?(Hash)
      return @data.include?(key)
    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 26
    def should_respond?
      return @data[:process_results] if @data.include?(:process_results)

      return true
    end

to_hash() click to toggle source

    # File lib/mcollective/rpc/request.rb, line 38
    def to_hash
      return {:agent => @agent,
        :action => @action,
        :data => @data}
    end

to_json() click to toggle source

    # File lib/mcollective/rpc/request.rb, line 44
    def to_json
      to_hash.merge!({:sender   => @sender,
                       :callerid => @callerid,
                       :uniqid   => @uniqid}).to_json
    end

### Public Class Methods

new(msg) click to toggle source

    # File lib/mcollective/rpc/request.rb, line 7
    def initialize(msg)
      @time = msg[:msgtime]
      @action = msg[:body][:action]
      @data = msg[:body][:data]
      @sender = msg[:senderid]
      @agent = msg[:body][:agent]
      @uniqid = msg[:requestid]
      @caller = msg[:callerid] || "unknown"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.