Sha256: d5a4dce5977e068a5da65e164a93975b7034923dfb8501442c36a7932fcfeb0f
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
module LinkedIn class Error < StandardError; end class ServiceError < Error attr_reader :source def initialize(response = {}) @source = Hashie::Mash.new response end def message return self.class.name if body.message.empty? body.message end def status response.status end def body response.body end def request @request ||= Hashie::Mash.new url: source.url, headers: source.request_headers, params: source.params end def response @response ||= Hashie::Mash.new status: source.status, body: source.body, headers: source.response_headers end end class BadRequest < ServiceError; end class Unauthorized < ServiceError; end class Forbidden < ServiceError; end class NotFound < ServiceError; end class InternalServerError < ServiceError; 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
linkedin2-0.0.19 | lib/linkedin/errors.rb |
linkedin2-0.0.18 | lib/linkedin/errors.rb |
linkedin2-0.0.17 | lib/linkedin/errors.rb |