class MailChimp3::Errors::BaseError

Attributes

details[R]
status[R]

Public Class Methods

new(body:, status:) click to toggle source
# File lib/mailchimp3/errors.rb, line 9
def initialize(body:, status:)
  @status = status
  @message = if body.is_a?(Hash) && body['error']
               "#{body['name']}: #{body['error']}"
             elsif body.is_a?(Hash)
               "#{body['title']}: #{body['detail']}"
             else
               body.to_s
             end
  @details = body if body.is_a?(Hash)
end

Public Instance Methods

inspect() click to toggle source
# File lib/mailchimp3/errors.rb, line 25
def inspect
  "<#{self.class.name} status=#{@status} message=#{@message}>"
end
to_s() click to toggle source
# File lib/mailchimp3/errors.rb, line 21
def to_s
  @message
end