URI::Params::Serializable
Including this module will make an object serializable to and from HTTP params query.
It adds a .from_query(query : String) and #to_query : String methods.
Class methods
build_path(path : Array(String)) : String
Build query path from an array of path elements.
build_path(["foo", "bar", ""]) # => "foo[bar][]"
build_path(*path : *T) : String forall T
Build query path from a tuple of path elements.
build_path("foo", "bar", "") # => "foo[bar][]"
split_path(path : String) : Array(String)
Split query path into path elements.
"foo[bar][]".split # => ["foo", "bar", ""]
Instance methods
to_http_param(builder : Builder, key : String | Nil = nil)
Serialalize self into an HTTP params query with the builder at key.
See #to_query for instance variable rules.
to_query
Serialalize self into an HTTP params query, returning a String.
Instance variables are by default seralized under camelCased keys,
unless explicitly specified with @[HTTP::Param(key: "mykey").
Nested types
- URI::Params::Serializable::EmptyIndexForNonScalarArrayParamError
- URI::Params::Serializable::Error
- URI::Params::Serializable::ExplicitKeyForNonScalarParam
- URI::Params::Serializable::InvalidParamIndexError
- URI::Params::Serializable::NestedContentForScalarParamError
- URI::Params::Serializable::ParamIndexOutOfBoundsError
- URI::Params::Serializable::ParamMissingError
- URI::Params::Serializable::ParamTypeCastError
- URI::Params::Serializable::Scalar