Class: Wamp::Client::Request::Register
- Defined in:
- lib/wamp/client/request/register.rb
Instance Attribute Summary
Attributes inherited from Base
#on_success, #requests, #send_message_callback, #session
Instance Method Summary collapse
- #create_request(request_id, procedure, handler, options = nil, interrupt = nil, &callback) ⇒ Object
- #process_error(message, lookup) ⇒ Object
- #process_success(message, lookup) ⇒ Object
Methods inherited from Base
#error, #generate_id, #initialize, #request, #success
Constructor Details
This class inherits a constructor from Wamp::Client::Request::Base
Instance Method Details
#create_request(request_id, procedure, handler, options = nil, interrupt = nil, &callback) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/wamp/client/request/register.rb', line 17 def create_request(request_id, procedure, handler, =nil, interrupt=nil, &callback) # Create the lookup lookup = {p: procedure, h: handler, i: interrupt, o: , c: callback} # Create the message = Message::Register.new(request_id, , procedure) # Return [lookup, ] end |
#process_error(message, lookup) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/wamp/client/request/register.rb', line 57 def process_error(, lookup) if lookup # Get the params procedure = lookup[:p] callback = lookup[:c] # Create the details details = .details || {} details[:procedure] = procedure unless details[:procedure] details[:type] = 'register' # Return the values [callback, details] else [nil, nil] end end |
#process_success(message, lookup) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/wamp/client/request/register.rb', line 29 def process_success(, lookup) if lookup # Get the params procedure = lookup[:p] handler = lookup[:h] = lookup[:o] interrupt = lookup[:i] callback = lookup[:c] # Create the subscription r_id = .registration r = Manager::RegistrationObject.new(procedure, handler, , interrupt, self.session, r_id) # Create the details details = {} details[:procedure] = procedure details[:type] = 'register' # Call the on_success method self.on_success.call(r_id, r) # Return the values [callback, r, details] else [nil, nil, nil] end end |