Class: Pubnub::SetUuidMetadata
- Inherits:
-
SingleEvent
- Object
- Event
- SingleEvent
- Pubnub::SetUuidMetadata
- Includes:
- Concurrent::Async, Validator::SetUuidMetadata
- Defined in:
- lib/pubnub/events/set_uuid_metadata.rb
Overview
Holds SetUuidMetadata functionality
Instance Attribute Summary
Attributes inherited from Event
#callback, #channel, #channel_group, #fresh_clone, #given_options, #group, #idle_timeout, #open_timeout, #origin, #presence_callback, #read_timeout, #ssl, #state, #wildcard_channel, #with_presence
Instance Method Summary collapse
- #fire ⇒ Object
-
#initialize(options, app) ⇒ SetUuidMetadata
constructor
A new instance of SetUuidMetadata.
Methods included from Validator::SetUuidMetadata
Methods included from Validator::CommonValidator
#validate_origin, #validate_publish_key, #validate_subscribe_key, #validate_user_id
Methods inherited from Event
#finalized?, #send_request, #sync?, #uri
Methods included from Event::EFormatter
#format_channels, #format_envelopes, #format_group
Constructor Details
#initialize(options, app) ⇒ SetUuidMetadata
Returns a new instance of SetUuidMetadata.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pubnub/events/set_uuid_metadata.rb', line 10 def initialize(, app) @event = current_operation @telemetry_name = :l_obj @uuid = [:uuid].nil? ? app.user_id : [:uuid] # Clean up user-provided metadata object from nils. = [:metadata].delete_if { |_k, v| v.blank? } unless [:metadata].nil? if [:include] @include = [0, '0', false].include?([:include][:custom]) ? "0" : "1" unless [:include][:custom].nil? end # Single entity creation should return it's 'custom' field by default. @include = "custom" if @include.nil? super end |
Instance Method Details
#fire ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/pubnub/events/set_uuid_metadata.rb', line 28 def fire Pubnub.logger.debug('Pubnub::SetUuidMetadata') { "Fired event #{self.class}" } body = Formatter.(, nil, false) response = send_request(body) envelopes = fire_callbacks(handle(response, uri)) finalize_event(envelopes) envelopes end |