Sha256: 78280054ffbd2c4d3a2245f7994e606ab0d1b3aee54829224443a0746fd196ae

Contents?: true

Size: 1.74 KB

Versions: 9

Compression:

Stored size: 1.74 KB

Contents

# Toplevel Pubnub module.
# frozen_string_literal: true

module Pubnub
  # Holds GetSpace functionality
  class GetSpace < SingleEvent
    include Concurrent::Async
    include Pubnub::Validator::GetSpace

    def initialize(options, app)
      @event = :get_space
      @telemetry_name = :l_obj
      @space_id = options[:space_id]
      @include = options[:include]
      super
    end

    private

    def current_operation
      Pubnub::Constants::OPERATION_GET_SPACE
    end

    def parameters(*_args)
      parameters = super
      parameters[:include] = @include if @include
      parameters
    end

    def path
      '/' + [
        'v1',
        'objects',
        @subscribe_key,
        'spaces',
        @space_id
      ].join('/')
    end

    def valid_envelope(parsed_response, req_res_objects)
      Pubnub::Envelope.new(
        event: @event,
        event_options: @given_options,
        timetoken: nil,

        result: {
          code: req_res_objects[:response].code,
          operation: Pubnub::Constants::OPERATION_GET_SPACE,
          client_request: req_res_objects[:request],
          server_response: req_res_objects[:response],
          data: parsed_response
        },

        status: {
          code: req_res_objects[:response].code,
          operation: Pubnub::Constants::OPERATION_GET_SPACE,
          client_request: req_res_objects[:request],
          server_response: req_res_objects[:response],
          data: nil,
          category: Pubnub::Constants::STATUS_ACK,
          error: false,
          auto_retried: false,

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

          config: get_config
        }
      )
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pubnub-4.3.0 lib/pubnub/events/get_space.rb
pubnub-4.2.7 lib/pubnub/events/get_space.rb
pubnub-4.2.6 lib/pubnub/events/get_space.rb
pubnub-4.2.5 lib/pubnub/events/get_space.rb
pubnub-4.2.4 lib/pubnub/events/get_space.rb
pubnub-4.2.3 lib/pubnub/events/get_space.rb
pubnub-4.2.2 lib/pubnub/events/get_space.rb
pubnub-4.2.1 lib/pubnub/events/get_space.rb
pubnub-4.2.0 lib/pubnub/events/get_space.rb