Module: Commons

Defined in:
lib/commons/errors/error_base.rb,
lib/commons.rb,
lib/commons/config.rb,
lib/commons/railtie.rb,
lib/commons/version.rb,
lib/commons/errors/conflict.rb,
lib/commons/errors/forbidden.rb,
lib/commons/errors/not_unique.rb,
lib/commons/errors/bad_request.rb,
lib/commons/errors/unauthorized.rb,
lib/commons/formatter/e164_phone.rb,
lib/commons/errors/route_not_found.rb,
lib/commons/formatter/string_utils.rb,
lib/commons/concerns/attributes/sex.rb,
lib/commons/errors/default_handling.rb,
lib/commons/errors/error_serializer.rb,
lib/commons/errors/invalid_resource.rb,
lib/commons/errors/maintenance_mode.rb,
lib/commons/errors/payment_required.rb,
lib/commons/errors/missing_parameter.rb,
lib/commons/errors/resource_not_found.rb,
lib/commons/formatter/regex_constants.rb,
lib/commons/errors/precondition_failed.rb,
lib/commons/services/concerns/callable.rb,
lib/commons/errors/unprocessable_entity.rb,
lib/commons/concerns/guard/capitalizable.rb,
lib/commons/controllers/schema_validable.rb,
lib/commons/errors/internal_server_error.rb,
lib/commons/repositories/base_repository.rb,
lib/commons/authentication/json_web_token.rb,
lib/commons/concerns/extensions/soft_deleted.rb,
lib/commons/formatter/null_attributes_remover.rb,
lib/commons/authentication/authenticate_by_jwt.rb,
lib/commons/concerns/validations/undestroyable.rb,
lib/commons/middleware/catch_json_parse_errors.rb,
lib/commons/repositories/catalogs/base_catalog.rb,
lib/commons/repositories/catalogs/concerns/model_caching_extention.rb

Overview

Author: [email protected]

Description: The APIError class aids us in defining a standard interface for how we handle the errors in our API.

It has two main functions:

1. Hold details of the error thrown so it can
be translated to one of the standard HTTP codes.
2. Provide a consistent way to "serialize" errors.

Attributes:

  • message: string, Holds a human friendly way to

describe the error.

  • status: integer, Denotes the HTTP status code.

  • error: string, Similar to message, but this

field is intended to show the error message from a raised error.

  • detail: Hash, Contains a more details about the

error.

Defined Under Namespace

Modules: Authentication, Concerns, Controllers, Errors, Formatter, Middleware, Repositories, Services Classes: Railtie

Constant Summary collapse

VERSION =
'0.16.0'.freeze

Class Method Summary collapse

Class Method Details

.secret_key_baseObject



7
8
9
# File 'lib/commons/config.rb', line 7

def secret_key_base
  @secret_key_base || ENV["secret_key_base"]
end

.secret_key_base=(secret_key_base) ⇒ Object



3
4
5
# File 'lib/commons/config.rb', line 3

def secret_key_base=(secret_key_base)
  @secret_key_base = secret_key_base
end