class AndSon::Response
Constants
- CODE_MATCHERS
Public Class Methods
parse(hash)
click to toggle source
# File lib/and-son/response.rb, line 14 def self.parse(hash) self.new(Sanford::Protocol::Response.parse(hash)) end
Public Instance Methods
data()
click to toggle source
# File lib/and-son/response.rb, line 18 def data if self.code_is_5xx? raise ServerError.new(self.protocol_response) elsif self.code_is_404? raise NotFoundError.new(self.protocol_response) elsif self.code_is_400? raise BadRequestError.new(self.protocol_response) elsif self.code_is_4xx? raise ClientError.new(self.protocol_response) else self.protocol_response.data end end