Manfred / Reynard

Minimal OpenAPI client for Ruby.
MIT License
12 stars 2 forks source link

Add accessors to Response for status code groups. #24

Closed Manfred closed 2 years ago

Manfred commented 2 years ago

Logic dealing with responses is not always concerned with the exact response code, but more along the lines of did I do something wrong, or did they do something wrong.

These accessors allow us to write code that reads a bit better in those cases:

if response.client_error?
  fix_and_retry
elsif response.server_error?
  report_error
end

Closes #23.