Responsible
Base module for top level macros and utilities.
Constants
Class methods
Macros
Wraps a expression that returns a supported response object into a
Responsible::Response and attempts to parse this into the specified type.
Wraps a expression that returns a supported response object into a
Responsible::Response and parse this into the specified type, or nil if
not compatible.
Wraps a expression that returns a supported response object into a
Responsible::Response before attempting to parse this out into the return
type of the surrounding method.
This may be used to provied a clean, minimal syntax when building methods that abstract over API calls.
def example_request : {response_field_a: String, response_field_b: Bool}
Responsible.parse_to_return_type do
HTTP::Client.get "https://www.example.com"
end
end
Adds Responsible support to the specified response type object.
ResponsibleInterface contains a minimal set of abstract methods that are compatible with HTTP::Client::Response` as well as many third-party
libraries without modification. If you do need to specify an implimentation
to map to other types, an option block may be used to specify the required
implementations.