Class: WampClient::Message::Yield

Inherits:
Base
  • Object
show all
Defined in:
lib/wamp_client/message.rb

Overview

Yield Actual yield from an endpoint sent by a Callee to Dealer. Formats:

[YIELD, INVOCATION.Request|id, Options|dict]
[YIELD, INVOCATION.Request|id, Options|dict, Arguments|list]
[YIELD, INVOCATION.Request|id, Options|dict, Arguments|list, ArgumentsKw|dict]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Check

included

Constructor Details

#initialize(invocation_request, options, arguments = nil, argumentskw = nil) ⇒ Yield

Returns a new instance of Yield.



1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
# File 'lib/wamp_client/message.rb', line 1081

def initialize(invocation_request, options, arguments=nil, argumentskw=nil)

  self.class.check_id('invocation_request', invocation_request)
  self.class.check_dict('options', options)
  self.class.check_list('arguments', arguments, true)
  self.class.check_dict('argumentskw', argumentskw, true)

  self.invocation_request = invocation_request
  self.options = options
  self.arguments = arguments
  self.argumentskw = argumentskw

end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



1079
1080
1081
# File 'lib/wamp_client/message.rb', line 1079

def arguments
  @arguments
end

#argumentskwObject

Returns the value of attribute argumentskw.



1079
1080
1081
# File 'lib/wamp_client/message.rb', line 1079

def argumentskw
  @argumentskw
end

#invocation_requestObject

Returns the value of attribute invocation_request.



1079
1080
1081
# File 'lib/wamp_client/message.rb', line 1079

def invocation_request
  @invocation_request
end

#optionsObject

Returns the value of attribute options.



1079
1080
1081
# File 'lib/wamp_client/message.rb', line 1079

def options
  @options
end

Class Method Details

.parse(params) ⇒ Object



1099
1100
1101
1102
1103
1104
1105
1106
1107
# File 'lib/wamp_client/message.rb', line 1099

def self.parse(params)

  self.check_gte('params list', 3, params.count)
  self.check_equal('message type', self.type, params[0])

  params.shift
  self.new(*params)

end

.typeObject



1095
1096
1097
# File 'lib/wamp_client/message.rb', line 1095

def self.type
  Types::YIELD
end

Instance Method Details

#payloadObject



1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
# File 'lib/wamp_client/message.rb', line 1109

def payload
  payload = [self.class.type]
  payload.push(self.invocation_request)
  payload.push(self.options)

  return payload if (self.arguments.nil? or self.arguments.empty?)
  payload.push(self.arguments)

  return payload if (self.argumentskw.nil? or self.argumentskw.empty?)
  payload.push(self.argumentskw)

  payload
end

#to_sObject



1123
1124
1125
# File 'lib/wamp_client/message.rb', line 1123

def to_s
  'YIELD > ' + self.payload.to_s
end