Google Cloud Platform environment queries - Class Google::Cloud::Env::ComputeMetadata::Response (v2.2.2)

Reference documentation and code samples for the Google Cloud Platform environment queries class Google::Cloud::Env::ComputeMetadata::Response.

Basic HTTP response object, returned by #lookup_response.

This object duck-types the status, body, and headers fields of Faraday::Response. It also includes the CLOCK_MONOTONIC time when the data was retrieved.

Inherits

  • Object

Methods

#body

def body() -> String

The HTTP response body

Returns
  • (String)

#google_flavor?

def google_flavor?() -> boolean

Returns true if the metadata-flavor is correct for Google Cloud

Returns
  • (boolean)

#headers

def headers() -> Hash{String=>String}

The HTTP response headers

Returns
  • (Hash{String=>String})

#initialize

def initialize(status, body, headers) -> Response

Create a response object.

Parameters
  • status (Integer) — The HTTP status, normally 200
  • body (String) — The HTTP body as a string
  • headers (Hash{String=>String}) — The HTTP response headers. Normally, the Metadata-Flavor header must be set to the value Google.
Returns
  • (Response) — a new instance of Response

#retrieval_monotonic_time

def retrieval_monotonic_time() -> Numeric

The CLOCK_MONOTONIC time at which this response was retrieved.

Returns
  • (Numeric)

#status

def status() -> Integer

The HTTP status code

Returns
  • (Integer)