class Apia::MissingArgumentError

This is raised when an argument set cannot be created because an argument that was required is not present on the source object.

Attributes

argument[R]

Public Class Methods

new(argument, path: []) click to toggle source
# File lib/apia/errors/missing_argument_error.rb, line 12
def initialize(argument, path: [])
  @argument = argument
  @path = path
end

Public Instance Methods

hash() click to toggle source
# 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() click to toggle source
# File lib/apia/errors/missing_argument_error.rb, line 17
def http_status
  400
end
path_string() click to toggle source
# File lib/apia/errors/missing_argument_error.rb, line 21
def path_string
  @path.map(&:name).join('.')
end