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
defbody()->String
The HTTP response body
Returns
(String)
#google_flavor?
defgoogle_flavor?()->boolean
Returns true if the metadata-flavor is correct for Google Cloud
Returns
(boolean)
#headers
defheaders()->Hash{String=>String}
The HTTP response headers
Returns
(Hash{String=>String})
#initialize
definitialize(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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["# Google Cloud Platform environment queries - Class Google::Cloud::Env::ComputeMetadata::Response (v2.3.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.3.1 (latest)](/ruby/docs/reference/google-cloud-env/latest/Google-Cloud-Env-ComputeMetadata-Response)\n- [2.3.0](/ruby/docs/reference/google-cloud-env/2.3.0/Google-Cloud-Env-ComputeMetadata-Response)\n- [2.2.2](/ruby/docs/reference/google-cloud-env/2.2.2/Google-Cloud-Env-ComputeMetadata-Response) \nReference documentation and code samples for the Google Cloud Platform environment queries class Google::Cloud::Env::ComputeMetadata::Response.\n\nBasic HTTP response object, returned by\n[#lookup_response](/ruby/docs/reference/google-cloud-env/latest/Google-Cloud-Env-ComputeMetadata#Google__Cloud__Env__ComputeMetadata_lookup_response_instance_ \"Google::Cloud::Env::ComputeMetadata#lookup_response (method)\").\n\n\n\u003cbr /\u003e\n\nThis object duck-types the `status`, `body`, and `headers` fields of\n`Faraday::Response`. It also includes the CLOCK_MONOTONIC time when\nthe data was retrieved. \n\nInherits\n--------\n\n- Object\n\nMethods\n-------\n\n### #body\n\n def body() -\u003e String\n\nThe HTTP response body \n**Returns**\n\n- (String)\n\n### #google_flavor?\n\n def google_flavor?() -\u003e boolean\n\nReturns true if the metadata-flavor is correct for Google Cloud \n**Returns**\n\n- (boolean)\n\n### #headers\n\n def headers() -\u003e Hash{String=\u003eString}\n\nThe HTTP response headers \n**Returns**\n\n- (Hash{String=\\\u003eString})\n\n### #initialize\n\n def initialize(status, body, headers) -\u003e Response\n\nCreate a response object. \n**Parameters**\n\n- **status** (Integer) --- The HTTP status, normally 200\n- **body** (String) --- The HTTP body as a string\n- **headers** (Hash{String=\\\u003eString}) --- The HTTP response headers. Normally, the `Metadata-Flavor` header must be set to the value `Google`. \n**Returns**\n\n- ([Response](./Google-Cloud-Env-ComputeMetadata-Response)) --- a new instance of Response\n\n### #retrieval_monotonic_time\n\n def retrieval_monotonic_time() -\u003e Numeric\n\nThe CLOCK_MONOTONIC time at which this response was retrieved. \n**Returns**\n\n- (Numeric)\n\n### #status\n\n def status() -\u003e Integer\n\nThe HTTP status code \n**Returns**\n\n- (Integer)"]]