Sha256: f5de00a52f5a0643a77622f6d2cacd9ec474b99648b3e6c8c0d4f8e4999b2552
Contents?: true
Size: 809 Bytes
Versions: 15
Compression:
Stored size: 809 Bytes
Contents
module LinkedIn class Error < StandardError extend Forwardable attr_accessor :request, :response delegate [:status, :body] => :response def initialize(error_data={}) if hash = Hash.try_convert(error_data) self.request, self.response = hash[:request], hash[:response] end super (self.response && self.response.body['message']) || error_data end end class BadRequest < Error; end class Unauthorized < Error; end class Forbidden < Error; end class NotFound < Error; end class InternalServerError < Error; end class CSRF < Error def initialize(expected=nil, received=nil) additional = "Excepted '#{expected}' but received '#{received}'" if expected super "Response state did not match sent state. #{additional}" end end end
Version data entries
15 entries across 15 versions & 1 rubygems