Class: SplitIoClient::SSE::EventSource::StreamData

Inherits:
Object
  • Object
show all
Defined in:
lib/splitclient-rb/sse/event_source/stream_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_type, client_id, data, channel) ⇒ StreamData

Returns a new instance of StreamData.



9
10
11
12
13
14
# File 'lib/splitclient-rb/sse/event_source/stream_data.rb', line 9

def initialize(event_type, client_id, data, channel)
  @event_type = event_type
  @client_id = client_id
  @data = data
  @channel = channel&.gsub(SplitIoClient::Constants::OCCUPANCY_CHANNEL_PREFIX, '')
end

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



7
8
9
# File 'lib/splitclient-rb/sse/event_source/stream_data.rb', line 7

def channel
  @channel
end

#client_idObject (readonly)

Returns the value of attribute client_id.



7
8
9
# File 'lib/splitclient-rb/sse/event_source/stream_data.rb', line 7

def client_id
  @client_id
end

#dataObject (readonly)

Returns the value of attribute data.



7
8
9
# File 'lib/splitclient-rb/sse/event_source/stream_data.rb', line 7

def data
  @data
end

#event_typeObject (readonly)

Returns the value of attribute event_type.



7
8
9
# File 'lib/splitclient-rb/sse/event_source/stream_data.rb', line 7

def event_type
  @event_type
end

Instance Method Details

#occupancy?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/splitclient-rb/sse/event_source/stream_data.rb', line 16

def occupancy?
  @channel.include? 'control'
end