Sha256: 7b85083ebf2a0ca3552f032c90d6392f86e30059d902f3ca90de7f5aee81464e
Contents?: true
Size: 1.23 KB
Versions: 3
Compression:
Stored size: 1.23 KB
Contents
# typed: true # frozen_string_literal: true require 'stream-chat/stream_rate_limits' require 'stream-chat/types' module StreamChat class StreamResponse < Hash extend T::Sig T::Configuration.default_checked_level = :never # For now we disable runtime type checks. # We will enable it with a major bump in the future, # but for now, let's just run a static type check. sig { returns(StreamRateLimits) } attr_reader :rate_limit sig { returns(Integer) } attr_reader :status_code sig { returns(StringKeyHash) } attr_reader :headers sig { params(hash: T::Hash[T.untyped, T.untyped], response: Faraday::Response).void } def initialize(hash, response) super(nil) merge!(hash) if response.headers.key?('X-Ratelimit-Limit') @rate_limit = T.let(StreamRateLimits.new( T.must(response.headers['X-Ratelimit-Limit']), T.must(response.headers['X-Ratelimit-Remaining']), T.must(response.headers['X-Ratelimit-Reset']) ), StreamRateLimits) end @status_code = T.let(response.status, Integer) @headers = T.let(response.headers, StringKeyHash) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
stream-chat-ruby-2.22.1 | lib/stream-chat/stream_response.rb |
stream-chat-ruby-2.22.0 | lib/stream-chat/stream_response.rb |
stream-chat-ruby-2.21.0 | lib/stream-chat/stream_response.rb |