Exception: LinkedIn::ServiceError

Inherits:
Error
  • Object
show all
Defined in:
lib/linkedin/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response = {}) ⇒ ServiceError

Returns a new instance of ServiceError.



7
8
9
# File 'lib/linkedin/errors.rb', line 7

def initialize(response = {})
  @source = Hashie::Mash.new response
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



5
6
7
# File 'lib/linkedin/errors.rb', line 5

def source
  @source
end

Instance Method Details

#bodyObject



20
21
22
# File 'lib/linkedin/errors.rb', line 20

def body
  response.body
end

#messageObject



11
12
13
14
# File 'lib/linkedin/errors.rb', line 11

def message
  return self.class.name if body.message.empty?
  body.message
end

#requestObject



24
25
26
# File 'lib/linkedin/errors.rb', line 24

def request
  @request ||= Hashie::Mash.new url: source.url, headers: source.request_headers, params: source.params
end

#responseObject



28
29
30
# File 'lib/linkedin/errors.rb', line 28

def response
  @response ||= Hashie::Mash.new status: source.status, body: source.body, headers: source.response_headers
end

#statusObject



16
17
18
# File 'lib/linkedin/errors.rb', line 16

def status
  response.status
end