Exception: TravelTimeAPI::BadRequest

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/traveltime_api.rb

Overview

Raised if API user made bad request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, details) ⇒ BadRequest

Returns a new instance of BadRequest.



30
31
32
33
# File 'lib/traveltime_api.rb', line 30

def initialize(code, details)
  @code = code
  @details = details
end

Instance Attribute Details

#codeObject (readonly)

Server provided String code for this error.



26
27
28
# File 'lib/traveltime_api.rb', line 26

def code
  @code
end

#detailsObject (readonly)

Server provided String explanation of error.



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

def details
  @details
end

Instance Method Details

#to_sObject



35
36
37
# File 'lib/traveltime_api.rb', line 35

def to_s
  "TravelTimeAPI::BadRequest[#{@code}: #{details}]"
end