Class: StreamChat::StreamResponse
- Inherits:
-
Hash
- Object
- Hash
- StreamChat::StreamResponse
- 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.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/stream-chat/stream_response.rb', line 12 def initialize(hash, response) super(nil) merge!(hash) if response.headers.key?('X-Ratelimit-Limit') @rate_limit = StreamRateLimits.new( response.headers['X-Ratelimit-Limit'], response.headers['X-Ratelimit-Remaining'], response.headers['X-Ratelimit-Reset'] ) end @status_code = response.status @headers = response.headers end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
10 11 12 |
# File 'lib/stream-chat/stream_response.rb', line 10 def headers @headers end |
#rate_limit ⇒ Object (readonly)
Returns the value of attribute rate_limit.
8 9 10 |
# File 'lib/stream-chat/stream_response.rb', line 8 def rate_limit @rate_limit end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
9 10 11 |
# File 'lib/stream-chat/stream_response.rb', line 9 def status_code @status_code end |