Class: Wamp::Client::Request::Unregister
- Defined in:
- lib/wamp/client/request/unregister.rb
Instance Attribute Summary
Attributes inherited from Base
#on_success, #requests, #send_message_callback, #session
Instance Method Summary collapse
- #create_request(request_id, registration, &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, registration, &callback) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/wamp/client/request/unregister.rb', line 16 def create_request(request_id, registration, &callback) # Create the lookup lookup = { r: registration, c: callback } # Create the message = Message::Unregister.new(request_id, registration.id) # Return [lookup, ] end |
#process_error(message, lookup) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/wamp/client/request/unregister.rb', line 49 def process_error(, lookup) if lookup # Get the params registration = lookup[:r] callback = lookup[:c] # Create the details details = .details || {} details[:procedure] = registration.procedure unless details[:procedure] details[:type] = 'unregister' # Return the values [callback, details] else [nil, nil] end end |
#process_success(message, lookup) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/wamp/client/request/unregister.rb', line 28 def process_success(, lookup) if lookup # Get the params registration = lookup[:r] callback = lookup[:c] # Create the details details = {} details[:procedure] = registration.procedure details[:type] = 'unregister' # Call the on_success method self.on_success.call(registration.id) # Return the values [callback, registration, details] else [nil, nil, nil] end end |