1.5.0 (latest) 1.4.1 1.3.0 1.2.0 1.1.0 1.0.1 0.26.0 0.25.0 0.24.0 Reference documentation and code samples for the gapic-common class Gapic::Rest::ServerStream.

A class to provide the Enumerable interface to the response of a REST server-streaming dmethod.


<br />

ServerStream provides the enumerations over the individual response messages within the stream.

## Inherits

- Object

## Includes

- Enumerable

## Example

normal iteration over resources.

```ruby
server_stream.each { |response| puts response }
```

## Methods

### #each

    def each() -> Enumerator

Iterate over JSON objects in the streamed response.
**Yields**

- (Object) --- Gives one complete Message object.
**Returns**

- (Enumerator) --- if no block is provided

### #initialize

    def initialize(message_klass, json_enumerator) -> ServerStream

Initializes ServerStream object.
**Parameters**

- **message_klass** (Class)
- **json_enumerator** (Enumerator\<String\>)
**Returns**

- ([ServerStream](https://docs.cloud.google.com/ruby/docs/reference/gapic-common/latest/Gapic-Rest-ServerStream)) --- a new instance of ServerStream