Class: Shipeasy::Admin::Generated::ErrorCode

Inherits:
Object
  • Object
show all
Defined in:
lib/shipeasy_admin/models/error_code.rb

Constant Summary collapse

BAD_REQUEST =
"BAD_REQUEST".freeze
UNAUTHORIZED =
"UNAUTHORIZED".freeze
FORBIDDEN =
"FORBIDDEN".freeze
PLAN_REQUIRED =
"PLAN_REQUIRED".freeze
NOT_FOUND =
"NOT_FOUND".freeze
ALREADY_EXISTS =
"ALREADY_EXISTS".freeze
INVALID_TRANSITION =
"INVALID_TRANSITION".freeze
IMMUTABLE_FIELD =
"IMMUTABLE_FIELD".freeze
REFERENCED_IN_USE =
"REFERENCED_IN_USE".freeze
VALIDATION =
"VALIDATION".freeze
REFERENCED_NOT_FOUND =
"REFERENCED_NOT_FOUND".freeze
GROUPS_WEIGHT_SUM =
"GROUPS_WEIGHT_SUM".freeze
EVENT_PENDING =
"EVENT_PENDING".freeze
INTERNAL =
"INTERNAL".freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all_varsObject



33
34
35
# File 'lib/shipeasy_admin/models/error_code.rb', line 33

def self.all_vars
  @all_vars ||= [BAD_REQUEST, UNAUTHORIZED, FORBIDDEN, PLAN_REQUIRED, NOT_FOUND, ALREADY_EXISTS, INVALID_TRANSITION, IMMUTABLE_FIELD, REFERENCED_IN_USE, VALIDATION, REFERENCED_NOT_FOUND, GROUPS_WEIGHT_SUM, EVENT_PENDING, INTERNAL].freeze
end

.build_from_hash(value) ⇒ String

Builds the enum from string

Parameters:

  • The (String)

    enum value in the form of the string

Returns:

  • (String)

    The enum value



40
41
42
# File 'lib/shipeasy_admin/models/error_code.rb', line 40

def self.build_from_hash(value)
  new.build_from_hash(value)
end

Instance Method Details

#build_from_hash(value) ⇒ String

Builds the enum from string

Parameters:

  • The (String)

    enum value in the form of the string

Returns:

  • (String)

    The enum value



47
48
49
50
# File 'lib/shipeasy_admin/models/error_code.rb', line 47

def build_from_hash(value)
  return value if ErrorCode.all_vars.include?(value)
  raise "Invalid ENUM value #{value} for class #ErrorCode"
end