Class: Providers::Anthropic::ApiResponse
- Inherits:
-
Data
- Object
- Data
- Providers::Anthropic::ApiResponse
- Defined in:
- lib/providers/anthropic.rb
Overview
Response wrapper containing both the parsed body and API metrics. Behaves like a Hash for backward compatibility (delegates to body).
Instance Attribute Summary collapse
-
#api_metrics ⇒ Object
readonly
Returns the value of attribute api_metrics.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Delegate Hash methods to body for backward compatibility.
- #dig ⇒ Object
- #fetch ⇒ Object
- #key?(key) ⇒ Boolean
- #to_h ⇒ Object
- #to_json ⇒ Object
Instance Attribute Details
#api_metrics ⇒ Object (readonly)
Returns the value of attribute api_metrics
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/providers/anthropic.rb', line 37 ApiResponse = Data.define(:body, :api_metrics) do # Delegate Hash methods to body for backward compatibility. # Callers using response["content"] continue to work unchanged. def [](key) = body[key] def dig(...) = body.dig(...) def fetch(...) = body.fetch(...) def key?(key) = body.key?(key) def to_h = body def to_json(...) = body.to_json(...) end |
#body ⇒ Object (readonly)
Returns the value of attribute body
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/providers/anthropic.rb', line 37 ApiResponse = Data.define(:body, :api_metrics) do # Delegate Hash methods to body for backward compatibility. # Callers using response["content"] continue to work unchanged. def [](key) = body[key] def dig(...) = body.dig(...) def fetch(...) = body.fetch(...) def key?(key) = body.key?(key) def to_h = body def to_json(...) = body.to_json(...) end |
Instance Method Details
#[](key) ⇒ Object
Delegate Hash methods to body for backward compatibility. Callers using response continue to work unchanged.
40 |
# File 'lib/providers/anthropic.rb', line 40 def [](key) = body[key] |
#dig ⇒ Object
41 |
# File 'lib/providers/anthropic.rb', line 41 def dig(...) = body.dig(...) |
#fetch ⇒ Object
42 |
# File 'lib/providers/anthropic.rb', line 42 def fetch(...) = body.fetch(...) |
#key?(key) ⇒ Boolean
43 |
# File 'lib/providers/anthropic.rb', line 43 def key?(key) = body.key?(key) |
#to_h ⇒ Object
44 |
# File 'lib/providers/anthropic.rb', line 44 def to_h = body |
#to_json ⇒ Object
45 |
# File 'lib/providers/anthropic.rb', line 45 def to_json(...) = body.to_json(...) |