Class: StreamChat::StreamResponse
- Inherits:
-
Hash
- Object
- Hash
- StreamChat::StreamResponse
- Extended by:
- T::Sig
- Defined in:
- lib/stream-chat/stream_response.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#rate_limit ⇒ Object
readonly
Returns the value of attribute rate_limit.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(hash, response) ⇒ StreamResponse
constructor
A new instance of StreamResponse.
Constructor Details
#initialize(hash, response) ⇒ StreamResponse
Returns a new instance of StreamResponse.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/stream-chat/stream_response.rb', line 21 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 |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
18 19 20 |
# File 'lib/stream-chat/stream_response.rb', line 18 def headers @headers end |
#rate_limit ⇒ Object (readonly)
Returns the value of attribute rate_limit.
12 13 14 |
# File 'lib/stream-chat/stream_response.rb', line 12 def rate_limit @rate_limit end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
15 16 17 |
# File 'lib/stream-chat/stream_response.rb', line 15 def status_code @status_code end |