module ZuoraAPI module Exceptions class Error < StandardError; end class AuthorizationNotPerformed < Error; end class ZuoraAPISessionError < Error attr_reader :code, :response attr_writer :default_message def initialize(message = nil,response=nil) @code = response.present? && response.class.to_s == "HTTParty::Response" ? response.code : nil @message = message @response = response @default_message = "Error with Zuora Session." end def to_s @message || @default_message end end class BadEntityError < Error attr_reader :code, :response, :errors, :successes attr_writer :default_message def initialize(message = nil,response=nil, errors = [], successes = [], *args) @code = response.present? && response.class.to_s == "HTTParty::Response" ? response.code : nil @message = message @response = response @default_message = "Error with Zuora Entity" @errors = errors @successes = successes end def to_s @message || @default_message end end class ZuoraAPIError < Error attr_reader :code, :response, :errors, :successes attr_writer :default_message def initialize(message = nil,response=nil, errors = [], successes = [], *args) @code = response.present? && response.class.to_s == "HTTParty::Response" ? response.code : nil @message = message @response = response @default_message = "Error communicating with Zuora." @errors = errors @successes = successes end def to_s @message || @default_message end end class ZuoraAPIRequestLimit < Error attr_reader :code, :response attr_writer :default_message def initialize(message = nil,response=nil, *args) @code = response.present? && response.class.to_s == "HTTParty::Response" ? response.code : nil @message = message @response = response @default_message = "Your request limit has been exceeded for zuora." end def to_s @message || @default_message end end class ZuoraAPILockCompetition < Error attr_reader :code, :response attr_writer :default_message def initialize(message = nil,response=nil, *args) @code = response.present? && response.class.to_s == "HTTParty::Response" ? response.code : nil @message = message @response = response @default_message = "Operation failed due to lock competition. Please retry" end def to_s @message || @default_message end end class ZuoraDataIntegrity < Error attr_reader :code, :response attr_writer :default_message def initialize(message = nil,response=nil, *args) @code = response.present? && response.class.to_s == "HTTParty::Response" ? response.code : nil @message = message @response = response @default_message = "Operation failed due to lock competition. Please retry" end def to_s @message || @default_message end end class ZuoraAPITemporaryError < Error attr_reader :code, :response attr_writer :default_message def initialize(message = nil,response=nil, *args) @code = response.present? && response.class.to_s == "HTTParty::Response" ? response.code : nil @message = message @response = response @default_message = "There is a temporary error with zuora system." end def to_s @message || @default_message end end class ZuoraAPIAuthenticationTypeError < Error attr_reader :code, :response attr_writer :default_message def initialize(message = nil,response=nil, *args) @code = response.present? && response.class.to_s == "HTTParty::Response" ? response.code : nil @message = message @response = response @default_message = "Authentication type is not supported by this Login" end def to_s @message || @default_message end end end end