class Agave::ApiError

Attributes

faraday_error[R]

Public Class Methods

new(faraday_error) click to toggle source
# File lib/agave/api_error.rb, line 6
def initialize(faraday_error)
  @faraday_error = faraday_error
end

Public Instance Methods

body() click to toggle source
# File lib/agave/api_error.rb, line 19
def body
  JSON.parse(faraday_error.response[:body])
end
message() click to toggle source
# File lib/agave/api_error.rb, line 10
def message
  [
    'AgaveCMS API Error',
    "Status: #{faraday_error.response[:status]}",
    'Response:',
    JSON.pretty_generate(body)
  ].join("\n")
end