Class: FederalRegister::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/federal_register/client.rb

Direct Known Subclasses

Base, FacetResultSet, ResultSet

Defined Under Namespace

Classes: BadRequest, RecordNotFound, ResponseError, ServerError

Class Method Summary collapse

Class Method Details

.get(url, *options) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/federal_register/client.rb', line 20

def self.get(url, *options)
  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)
  else
    raise HTTParty::ResponseError.new(response)
  end
end