module ReamazeAPI::Utils

Public Instance Methods

error_hash(exception) click to toggle source

Public: Hash used for error responses.

exception - An Exception instance

Returns a Hash.

# File lib/reamaze_api/utils.rb, line 21
def error_hash(exception)
  {
    success: false,
    payload: {
      error:   exception.class.name,
      message: exception.message
    }
  }
end
symbolize_hash(hash) click to toggle source

Public: Deep-symbolize keys in the given Hash.

hash - a Hash instance

Returns a Hash.

# File lib/reamaze_api/utils.rb, line 12
def symbolize_hash(hash)
  HashKeys.deep_symbolize_keys(hash)
end