Class: WampClient::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.



1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
# File 'lib/wamp_client/message.rb', line 1049

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.



1047
1048
1049
# File 'lib/wamp_client/message.rb', line 1047

def call_arguments
  @call_arguments
end

#call_argumentskwObject

Returns the value of attribute call_argumentskw.



1047
1048
1049
# File 'lib/wamp_client/message.rb', line 1047

def call_argumentskw
  @call_argumentskw
end

#detailsObject

Returns the value of attribute details.



1047
1048
1049
# File 'lib/wamp_client/message.rb', line 1047

def details
  @details
end

#registered_registrationObject

Returns the value of attribute registered_registration.



1047
1048
1049
# File 'lib/wamp_client/message.rb', line 1047

def registered_registration
  @registered_registration
end

#requestObject

Returns the value of attribute request.



1047
1048
1049
# File 'lib/wamp_client/message.rb', line 1047

def request
  @request
end

Class Method Details

.parse(params) ⇒ Object



1069
1070
1071
1072
1073
1074
1075
1076
1077
# File 'lib/wamp_client/message.rb', line 1069

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



1065
1066
1067
# File 'lib/wamp_client/message.rb', line 1065

def self.type
  Types::INVOCATION
end

Instance Method Details

#payloadObject



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

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



1097
1098
1099
# File 'lib/wamp_client/message.rb', line 1097

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