Module: Card::Set::All::Error::JsonFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod008-card-mod-format/all/error.rb,
card/tmpsets/set/mod007-card-mod-format/all/error.rb

Instance Method Summary collapse

Instance Method Details

#error_listObject



81
82
83
84
85
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 81

def error_list
  card.errors.each_with_object([]) do |(field, message), list|
    list << { field: field, message: message }
  end
end

#format_error(error) ⇒ Object



77
78
79
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 77

def format_error error
  { error_status: error_status, errors: error }
end

#view: bad_addressObject



73
74
75
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 73

view :bad_address do
  format_error super()
end

#view: denialObject



70
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 70

view :denial, :errors

#view: errorsObject



65
66
67
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 65

view :errors do
  format_error error_list
end

#view: not_foundObject



71
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 71

view :not_found, :errors

#view: server_errorObject



69
# File 'card/tmpsets/set/mod008-card-mod-format/all/error.rb', line 69

view :server_error, :errors