Class: StreamChat::StreamResponse

Inherits:
Hash
  • Object
show all
Defined in:
lib/stream-chat/stream_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#headersObject (readonly)

Returns the value of attribute headers.



10
11
12
# File 'lib/stream-chat/stream_response.rb', line 10

def headers
  @headers
end

#rate_limitObject (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_codeObject (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