class CybridApiId::ApiError
def initialize(arg = nil)
ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
ApiError.new("message")
ApiError.new
Usage examples:
def initialize(arg = nil) if arg.is_a? Hash if arg.key?(:message) || arg.key?('message') super(arg[:message] || arg['message']) else super arg end arg.each do |k, v| instance_variable_set "@#{k}", v end else super arg end end
def message
def message if @message.nil? msg = "Error message: the server returns an error" else msg = @message end msg += "\nHTTP status code: #{code}" if code msg += "\nResponse headers: #{response_headers}" if response_headers msg += "\nResponse body: #{response_body}" if response_body msg end
def to_s
def to_s message end