Skip to content

Commit f2fe19e

Browse files
author
Unai Abrisketa
authored
Add to_json method to BeyondApi::Error class (#55)
1 parent c0105c2 commit f2fe19e

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
beyond_api (0.22.1.pre)
4+
beyond_api (0.22.2.pre)
55
faraday (~> 1.9.0)
66

77
GEM

lib/beyond_api/error.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,17 @@ def initialize(data, status_code = nil)
1515

1616
super(data["message"] || data["error_description"])
1717
end
18+
19+
def to_json
20+
{
21+
error_id: @error_id,
22+
message: @message,
23+
details: @details,
24+
error: @error,
25+
error_description: @error_description,
26+
trace_id: @trace_id,
27+
status_code: @status_code
28+
}
29+
end
1830
end
1931
end

lib/beyond_api/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module BeyondApi
4-
VERSION = "0.22.1.pre"
4+
VERSION = "0.22.2.pre"
55
end

0 commit comments

Comments
 (0)