Exception: Apia::MissingArgumentError
- Inherits:
-
RuntimeError
- Object
- StandardError
- StandardError
- RuntimeError
- Apia::MissingArgumentError
- Defined in:
- lib/apia/errors/missing_argument_error.rb
Overview
This is raised when an argument set cannot be created because an argument that was required is not present on the source object.
Instance Attribute Summary collapse
-
#argument ⇒ Object
readonly
Returns the value of attribute argument.
Instance Method Summary collapse
- #hash ⇒ Object
- #http_status ⇒ Object
-
#initialize(argument, path: []) ⇒ MissingArgumentError
constructor
A new instance of MissingArgumentError.
- #path_string ⇒ Object
Constructor Details
#initialize(argument, path: []) ⇒ MissingArgumentError
Returns a new instance of MissingArgumentError.
12 13 14 15 |
# File 'lib/apia/errors/missing_argument_error.rb', line 12 def initialize(argument, path: []) @argument = argument @path = path end |
Instance Attribute Details
#argument ⇒ Object (readonly)
Returns the value of attribute argument.
10 11 12 |
# File 'lib/apia/errors/missing_argument_error.rb', line 10 def argument @argument end |
Instance Method Details
#hash ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/apia/errors/missing_argument_error.rb', line 25 def hash { code: 'missing_required_argument', description: "The '#{path_string}' argument is required but has not been provided", detail: { path: @path.map(&:name), argument: { name: argument.name, description: argument.description } } } end |
#http_status ⇒ Object
17 18 19 |
# File 'lib/apia/errors/missing_argument_error.rb', line 17 def http_status 400 end |
#path_string ⇒ Object
21 22 23 |
# File 'lib/apia/errors/missing_argument_error.rb', line 21 def path_string @path.map(&:name).join('.') end |