Class: Pubnub::Publish
- Inherits:
-
SingleEvent
- Object
- Event
- SingleEvent
- Pubnub::Publish
- Includes:
- Concurrent::Async, Validator::Publish
- Defined in:
- lib/pubnub/events/publish.rb
Overview
Holds publish functionality
Instance Attribute Summary collapse
-
#store ⇒ Object
readonly
Returns the value of attribute store.
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) ⇒ Publish
constructor
A new instance of Publish.
Methods included from Validator::Publish
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) ⇒ Publish
Returns a new instance of Publish.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pubnub/events/publish.rb', line 10 def initialize(, app) @event = :publish @telemetry_name = :l_pub # Override crypto module if custom cipher key has been used. random_iv = .key?(:random_iv) ? [:random_iv] : true [:crypto_module] = Crypto::CryptoModule.new_legacy([:cipher_key], random_iv) if [:cipher_key] super @sequence_number = sequence_number! @origination_time_token = @app.generate_ortt case @store when false @store = 0 @ttl = nil when true @store = 1 end end |
Instance Attribute Details
#store ⇒ Object (readonly)
Returns the value of attribute store.
8 9 10 |
# File 'lib/pubnub/events/publish.rb', line 8 def store @store end |
Instance Method Details
#fire ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/pubnub/events/publish.rb', line 31 def fire Pubnub.logger.debug('Pubnub::Publish') { "Fired event #{self.class}" } if @compressed compressed_body = Formatter.(@message, @crypto_module, false) response = send_request(compressed_body) else response = send_request end envelopes = fire_callbacks(handle(response, uri)) finalize_event(envelopes) envelopes end |