Exception: DuffelAPI::Errors::Error
- Inherits:
-
StandardError
- Object
- StandardError
- DuffelAPI::Errors::Error
show all
- Defined in:
- lib/duffel_api/errors/error.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(error, response = nil) ⇒ Error
Returns a new instance of Error.
8
9
10
11
12
13
14
15
|
# File 'lib/duffel_api/errors/error.rb', line 8
def initialize(error, response = nil)
raise ArgumentError, "Duffel errors expect a hash" unless error.is_a?(Hash)
@error = error
@response = response
super(error)
end
|
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
6
7
8
|
# File 'lib/duffel_api/errors/error.rb', line 6
def error
@error
end
|
Instance Method Details
#api_response ⇒ Object
49
50
51
|
# File 'lib/duffel_api/errors/error.rb', line 49
def api_response
APIResponse.new(@response)
end
|
#code ⇒ Object
37
38
39
|
# File 'lib/duffel_api/errors/error.rb', line 37
def code
@error["code"]
end
|
#documentation_url ⇒ Object
17
18
19
|
# File 'lib/duffel_api/errors/error.rb', line 17
def documentation_url
@error["documentation_url"]
end
|
#message ⇒ Object
25
26
27
|
# File 'lib/duffel_api/errors/error.rb', line 25
def message
@error["message"]
end
|
#request_id ⇒ Object
41
42
43
|
# File 'lib/duffel_api/errors/error.rb', line 41
def request_id
@error["request_id"]
end
|
#source ⇒ Object
45
46
47
|
# File 'lib/duffel_api/errors/error.rb', line 45
def source
@error["source"]
end
|
#title ⇒ Object
21
22
23
|
# File 'lib/duffel_api/errors/error.rb', line 21
def title
@error["title"]
end
|
#to_s ⇒ Object
29
30
31
|
# File 'lib/duffel_api/errors/error.rb', line 29
def to_s
@error["message"]
end
|
#type ⇒ Object
33
34
35
|
# File 'lib/duffel_api/errors/error.rb', line 33
def type
@error["type"]
end
|