Class: FederalRegister::Client
- Inherits:
-
Object
- Object
- FederalRegister::Client
- Includes:
- HTTParty
- Defined in:
- lib/federal_register/client.rb
Direct Known Subclasses
Defined Under Namespace
Classes: BadRequest, GatewayTimeout, RecordNotFound, ResponseError, ServerError, ServiceUnavailable
Class Method Summary collapse
Class Method Details
.get(url, *options) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/federal_register/client.rb', line 22 def self.get(url, *) response = super case response.code when 200 response when 400 raise BadRequest.new(response) when 404 raise RecordNotFound.new(response) when 500 raise ServerError.new(response) when 503 raise ServiceUnavailable.new(response) when 504 raise GatewayTimeout.new(response) else raise HTTParty::ResponseError.new(response) end end |