gapic-common - Class Gapic::Rest::ServerStream (v0.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.

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

Inherits

  • Object

Includes

  • Enumerable

Example

normal iteration over resources.

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