Sonarr::Query
Structured, URI-encoded query-string builder for typed endpoints.
Handles Sonarr's paging parameters (page, pageSize, sortKey,
sortDirection) plus arbitrary filters:
nilvalues are dropped.Arrayvalues are emitted as repeated keys (seriesIds=1&seriesIds=2), matching Sonarr's ASP.NET Core model binding.- enum values are serialized via
#to_sonarr_valuewhen available (so the exact schema string, e.g.ascending, is sent),Timevia RFC 3339, everything else via#to_s.
Insertion order is preserved, so rendering is deterministic and the class is pure/unit-testable — it performs no I/O and never touches the client.
Sonarr::Query.paging(page: 2, page_size: 50, sort_key: "date")
.add("seriesIds", [1, 2])
.to_s # => "page=2&pageSize=50&sortKey=date&seriesIds=1&seriesIds=2"
Constructors
from(params) : self
Builds a query from a plain hash of params. Used by the generic verbs for backwards compatibility.
new
Sourcepaging(page = nil, page_size = nil, sort_key = nil, sort_direction = nil) : self
Builds a query pre-populated with paging parameters.
Instance methods
add(key : String, value) : self
Appends value under key. Arrays expand to repeated keys; nil is
dropped. Chainable.
empty?
Sourcepaging(page = nil, page_size = nil, sort_key = nil, sort_direction = nil) : self
Appends the standard paging parameters (nil ones are skipped). Chainable.