Class: Mrkt::Errors

Inherits:
Object
  • Object
show all
Defined in:
lib/mrkt/errors.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

Unknown =
create_class
EmptyResponse =
create_class
AuthorizationError =
create_class
RESPONSE_CODE_TO_ERROR =
{
  413  => 'RequestEntityTooLarge',
  600  => 'EmptyAccessToken',
  601  => 'AccessTokenInvalid',
  602  => 'AccessTokenExpired',
  603  => 'AccessDenied',
  604  => 'RequestTimedOut',
  605  => 'HTTPMethodNotSupported',
  606  => 'MaxRateLimit',
  607  => 'DailyQuotaReached',
  608  => 'APITemporarilyUnavailable',
  609  => 'InvalidJSON',
  610  => 'RequestedResourceNotFound',
  611  => 'System',
  612  => 'InvalidContentType',
  703  => 'DisabledFeature',
  1001 => 'TypeMismatch',
  1002 => 'MissingParamater',
  1003 => 'UnspecifiedAction',
  1004 => 'LeadNotFound',
  1005 => 'LeadAlreadyExists',
  1006 => 'FieldNotFound',
  1007 => 'MultipleLeadsMatching',
  1008 => 'PartitionAccessDenied',
  1009 => 'PartitionNameUnspecified',
  1010 => 'PartitionUpdateDenied',
  1011 => 'FieldNotSupported',
  1012 => 'InvalidCookieValue',
  1013 => 'ObjectNotFound',
  1014 => 'FailedToCreateObject'
}

Class Method Summary collapse

Class Method Details

.create_classObject



5
6
7
# File 'lib/mrkt/errors.rb', line 5

def self.create_class
  Class.new(Error)
end

.find_by_response_code(response_code) ⇒ Object



49
50
51
# File 'lib/mrkt/errors.rb', line 49

def self.find_by_response_code(response_code)
  const_get(RESPONSE_CODE_TO_ERROR.fetch(response_code, 'Error'))
end