Sha256: 4aaf6188fc7960ab3a0b3e01f1d193ef9e67d05321c6f66190fc2d103b613f55
Contents?: true
Size: 616 Bytes
Versions: 11
Compression:
Stored size: 616 Bytes
Contents
class ShippingEasy::Http::ResponseHandler extend Forwardable def_delegators :response, :status, :body attr_reader :response def initialize(response) @response = response end def self.run(response) new(response).run end def run case status when 200, 201 then JSON.parse(response.body) when 400 then raise ShippingEasy::InvalidRequestError, response.body when 401 then raise ShippingEasy::AccessDeniedError, response.body when 404 then raise ShippingEasy::ResourceNotFoundError, response.body else raise ShippingEasy::Error, response.body end end end
Version data entries
11 entries across 11 versions & 1 rubygems