Class: Wamp::Client::Message::Invocation

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

Overview

Invocation Actual invocation of an endpoint sent by Dealer to a Callee. Formats:

[INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict]
[INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict, CALL.Arguments|list]
[INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict, CALL.Arguments|list, CALL.ArgumentsKw|dict]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Check

included

Constructor Details

#initialize(request, registered_registration, details, call_arguments = nil, call_argumentskw = nil) ⇒ Invocation

Returns a new instance of Invocation.



971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
# File 'lib/wamp/client/message.rb', line 971

def initialize(request, registered_registration, details, call_arguments=nil, call_argumentskw=nil)

  self.class.check_id('request', request)
  self.class.check_id('registered_registration', registered_registration)
  self.class.check_dict('details', details)
  self.class.check_list('call_arguments', call_arguments, true)
  self.class.check_dict('call_argumentskw', call_argumentskw, true)

  self.request = request
  self.registered_registration = registered_registration
  self.details = details
  self.call_arguments = call_arguments
  self.call_argumentskw = call_argumentskw

end

Instance Attribute Details

#call_argumentsObject

Returns the value of attribute call_arguments.



969
970
971
# File 'lib/wamp/client/message.rb', line 969

def call_arguments
  @call_arguments
end

#call_argumentskwObject

Returns the value of attribute call_argumentskw.



969
970
971
# File 'lib/wamp/client/message.rb', line 969

def call_argumentskw
  @call_argumentskw
end

#detailsObject

Returns the value of attribute details.



969
970
971
# File 'lib/wamp/client/message.rb', line 969

def details
  @details
end

#registered_registrationObject

Returns the value of attribute registered_registration.



969
970
971
# File 'lib/wamp/client/message.rb', line 969

def registered_registration
  @registered_registration
end

#requestObject

Returns the value of attribute request.



969
970
971
# File 'lib/wamp/client/message.rb', line 969

def request
  @request
end

Class Method Details

.parse(params) ⇒ Object



991
992
993
994
995
996
997
998
999
# File 'lib/wamp/client/message.rb', line 991

def self.parse(params)

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

  params.shift
  self.new(*params)

end

.typeObject



987
988
989
# File 'lib/wamp/client/message.rb', line 987

def self.type
  Types::INVOCATION
end

Instance Method Details

#payloadObject



1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
# File 'lib/wamp/client/message.rb', line 1001

def payload
  self.call_arguments ||= []
  self.call_argumentskw ||= {}

  payload = [self.class.type]
  payload.push(self.request)
  payload.push(self.registered_registration)
  payload.push(self.details)

  return payload if (self.call_arguments.empty? and self.call_argumentskw.empty?)
  payload.push(self.call_arguments)

  return payload if (self.call_argumentskw.empty?)
  payload.push(self.call_argumentskw)

  payload
end

#to_sObject



1019
1020
1021
# File 'lib/wamp/client/message.rb', line 1019

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