Module: StreamChat

Extended by:
T::Sig
Defined in:
lib/stream-chat/types.rb,
lib/stream-chat/util.rb,
lib/stream-chat/client.rb,
lib/stream-chat/errors.rb,
lib/stream-chat/channel.rb,
lib/stream-chat/version.rb,
lib/stream-chat/campaign.rb,
lib/stream-chat/moderation.rb,
lib/stream-chat/stream_response.rb,
lib/stream-chat/stream_rate_limits.rb,
lib/stream-chat/channel_batch_updater.rb

Overview

typed: strict frozen_string_literal: true

Defined Under Namespace

Classes: Campaign, Channel, ChannelBatchUpdater, Client, Moderation, StreamAPIException, StreamChannelException, StreamRateLimits, StreamResponse

Constant Summary collapse

StringKeyHash =
T.type_alias { T::Hash[T.any(String, Symbol), T.untyped] }
SortArray =
T.type_alias { T::Array[{ field: String, direction: Integer }] }
DEFAULT_BLOCKLIST =
'profanity_en_2020_v1'
SOFT_DELETE =
'soft'
HARD_DELETE =
'hard'
VERSION =
'3.23.0'

Class Method Summary collapse

Class Method Details

.get_sort_fields(sort) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/stream-chat/util.rb', line 10

def self.get_sort_fields(sort)
  sort_fields = T.let([], SortArray)
  sort&.each do |k, v|
    sort_fields << { field: k, direction: v }
  end
  sort_fields
end

.normalize_timestamp(timestamp) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/stream-chat/util.rb', line 20

def self.normalize_timestamp(timestamp)
  case timestamp
  when DateTime then timestamp.rfc3339
  when Time then timestamp.iso8601
  else timestamp
  end
end