Exception: TimeTree::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/timetree/api_error.rb

Overview

TimeTree apis client error object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ApiError

Returns a new instance of ApiError.



17
18
19
20
21
22
23
# File 'lib/timetree/api_error.rb', line 17

def initialize(response)
  @response = response
  @type = response.body[:type]
  @title = response.body[:title]
  @errors = response.body[:errors]
  @status = response.status
end

Instance Attribute Details

#errorsString (readonly)

Returns:

  • (String)


13
14
15
# File 'lib/timetree/api_error.rb', line 13

def errors
  @errors
end

#responseFaraday::Response (readonly)

Returns:

  • (Faraday::Response)


7
8
9
# File 'lib/timetree/api_error.rb', line 7

def response
  @response
end

#statusInteger (readonly)

Returns:

  • (Integer)


15
16
17
# File 'lib/timetree/api_error.rb', line 15

def status
  @status
end

#titleString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/timetree/api_error.rb', line 11

def title
  @title
end

#typeString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/timetree/api_error.rb', line 9

def type
  @type
end

Instance Method Details

#inspectObject



25
26
27
# File 'lib/timetree/api_error.rb', line 25

def inspect
  "\#<#{self.class}:#{object_id} title:#{title}, status:#{status}>"
end