Sha256: 6dfdd1994e61a4586460798478c502d2ffd2c66472817e00dcd30309d4b6529a

Contents?: true

Size: 1.5 KB

Versions: 16

Compression:

Stored size: 1.5 KB

Contents

module Pubnub
  # Holds revoke token functionality
  class RevokeToken < SingleEvent
    include Concurrent::Async
    include Pubnub::Validator::RevokeToken

    def initialize(options, app)
      @event = :revoke_token
      super
      @token = @token.split(' ')
            .map{ |part| CGI.escape(part) }
            .join("%20")
    end

    private

    def current_operation
      Pubnub::Constants::OPERATION_GRANT_TOKEN
    end

    def valid_envelope(parsed_response, req_res_objects)
      Pubnub::Envelope.new(
        event: @event,
        event_options: @given_options,
        timetoken: nil,
        status: {
          code: req_res_objects[:response].code,
          client_request: req_res_objects[:request],
          server_response: req_res_objects[:response],
          category: Pubnub::Constants::STATUS_ACK,
          error: false,
          auto_retried: false,

          current_timetoken: nil,
          last_timetoken: nil,
          subscribed_channels: nil,
          subscribed_channel_groups: nil,

          data: nil,

          config: get_config

        },
        result: {
          code: req_res_objects[:response].code,
          operation: current_operation,
          client_request: req_res_objects[:request],
          server_response: req_res_objects[:response],

          data: parsed_response['data']
        }
      )
    end


    def path
      '/' + [
        'v3',
        'pam',
        @subscribe_key,
        'grant',
        @token
      ].join('/')
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
pubnub-5.5.0 lib/pubnub/events/revoke_token.rb
pubnub-5.4.0 lib/pubnub/events/revoke_token.rb
pubnub-5.3.5 lib/pubnub/events/revoke_token.rb
pubnub-5.3.4 lib/pubnub/events/revoke_token.rb
pubnub-5.3.3 lib/pubnub/events/revoke_token.rb
pubnub-5.3.2 lib/pubnub/events/revoke_token.rb
pubnub-5.3.1 lib/pubnub/events/revoke_token.rb
pubnub-5.3.0 lib/pubnub/events/revoke_token.rb
pubnub-5.2.2 lib/pubnub/events/revoke_token.rb
pubnub-5.2.1 lib/pubnub/events/revoke_token.rb
pubnub-5.2.0 lib/pubnub/events/revoke_token.rb
pubnub-5.1.2 lib/pubnub/events/revoke_token.rb
pubnub-5.1.1 lib/pubnub/events/revoke_token.rb
pubnub-5.1.0 lib/pubnub/events/revoke_token.rb
pubnub-5.0.0 lib/pubnub/events/revoke_token.rb
pubnub-4.8.0 lib/pubnub/events/revoke_token.rb