stream-chat-ruby 2.23.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +2 -0
- data/lib/stream-chat/channel.rb +40 -43
- data/lib/stream-chat/client.rb +118 -121
- data/lib/stream-chat/errors.rb +7 -10
- data/lib/stream-chat/stream_rate_limits.rb +4 -7
- data/lib/stream-chat/stream_response.rb +4 -7
- data/lib/stream-chat/types.rb +0 -3
- data/lib/stream-chat/util.rb +1 -4
- data/lib/stream-chat/version.rb +1 -1
- metadata +2 -2
data/lib/stream-chat/errors.rb
CHANGED
@@ -4,23 +4,20 @@
|
|
4
4
|
module StreamChat
|
5
5
|
class StreamAPIException < StandardError
|
6
6
|
extend T::Sig
|
7
|
-
# For now we disable runtime type checks.
|
8
|
-
# We will enable it with a major bump in the future,
|
9
|
-
# but for now, let's just run a static type check.
|
10
7
|
|
11
|
-
|
8
|
+
sig { returns(Integer) }
|
12
9
|
attr_reader :error_code
|
13
10
|
|
14
|
-
|
11
|
+
sig { returns(String) }
|
15
12
|
attr_reader :error_message
|
16
13
|
|
17
|
-
|
14
|
+
sig { returns(T::Boolean) }
|
18
15
|
attr_reader :json_response
|
19
16
|
|
20
|
-
|
17
|
+
sig { returns(Faraday::Response) }
|
21
18
|
attr_reader :response
|
22
19
|
|
23
|
-
|
20
|
+
sig { params(response: Faraday::Response).void }
|
24
21
|
def initialize(response)
|
25
22
|
super()
|
26
23
|
@response = response
|
@@ -34,7 +31,7 @@ module StreamChat
|
|
34
31
|
end
|
35
32
|
end
|
36
33
|
|
37
|
-
|
34
|
+
sig { returns(String) }
|
38
35
|
def message
|
39
36
|
if @json_response
|
40
37
|
"StreamChat error code #{@error_code}: #{@error_message}"
|
@@ -43,7 +40,7 @@ module StreamChat
|
|
43
40
|
end
|
44
41
|
end
|
45
42
|
|
46
|
-
|
43
|
+
sig { returns(String) }
|
47
44
|
def to_s
|
48
45
|
message
|
49
46
|
end
|
@@ -4,20 +4,17 @@
|
|
4
4
|
module StreamChat
|
5
5
|
class StreamRateLimits
|
6
6
|
extend T::Sig
|
7
|
-
# For now we disable runtime type checks.
|
8
|
-
# We will enable it with a major bump in the future,
|
9
|
-
# but for now, let's just run a static type check.
|
10
7
|
|
11
|
-
|
8
|
+
sig { returns(Integer) }
|
12
9
|
attr_reader :limit
|
13
10
|
|
14
|
-
|
11
|
+
sig { returns(Integer) }
|
15
12
|
attr_reader :remaining
|
16
13
|
|
17
|
-
|
14
|
+
sig { returns(Time) }
|
18
15
|
attr_reader :reset
|
19
16
|
|
20
|
-
|
17
|
+
sig { params(limit: String, remaining: String, reset: String).void }
|
21
18
|
def initialize(limit, remaining, reset)
|
22
19
|
@limit = T.let(limit.to_i, Integer)
|
23
20
|
@remaining = T.let(remaining.to_i, Integer)
|
@@ -7,20 +7,17 @@ require 'stream-chat/types'
|
|
7
7
|
module StreamChat
|
8
8
|
class StreamResponse < Hash
|
9
9
|
extend T::Sig
|
10
|
-
# For now we disable runtime type checks.
|
11
|
-
# We will enable it with a major bump in the future,
|
12
|
-
# but for now, let's just run a static type check.
|
13
10
|
|
14
|
-
|
11
|
+
sig { returns(StreamRateLimits) }
|
15
12
|
attr_reader :rate_limit
|
16
13
|
|
17
|
-
|
14
|
+
sig { returns(Integer) }
|
18
15
|
attr_reader :status_code
|
19
16
|
|
20
|
-
|
17
|
+
sig { returns(StringKeyHash) }
|
21
18
|
attr_reader :headers
|
22
19
|
|
23
|
-
|
20
|
+
sig { params(hash: T::Hash[T.untyped, T.untyped], response: Faraday::Response).void }
|
24
21
|
def initialize(hash, response)
|
25
22
|
super(nil)
|
26
23
|
merge!(hash)
|
data/lib/stream-chat/types.rb
CHANGED
@@ -3,9 +3,6 @@
|
|
3
3
|
|
4
4
|
module StreamChat
|
5
5
|
extend T::Sig
|
6
|
-
# For now we disable runtime type checks.
|
7
|
-
# We will enable it with a major bump in the future,
|
8
|
-
# but for now, let's just run a static type check.
|
9
6
|
|
10
7
|
StringKeyHash = T.type_alias { T::Hash[T.any(String, Symbol), T.untyped] }
|
11
8
|
SortArray = T.type_alias { T::Array[{ field: String, direction: Integer }] }
|
data/lib/stream-chat/util.rb
CHANGED
@@ -5,11 +5,8 @@ require 'stream-chat/types'
|
|
5
5
|
|
6
6
|
module StreamChat
|
7
7
|
extend T::Sig
|
8
|
-
# For now we disable runtime type checks.
|
9
|
-
# We will enable it with a major bump in the future,
|
10
|
-
# but for now, let's just run a static type check.
|
11
8
|
|
12
|
-
|
9
|
+
sig { params(sort: T.nilable(T::Hash[String, Integer])).returns(SortArray) }
|
13
10
|
def self.get_sort_fields(sort)
|
14
11
|
sort_fields = T.let([], SortArray)
|
15
12
|
sort&.each do |k, v|
|
data/lib/stream-chat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stream-chat-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- getstream.io
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|