Exception: JSONAPI::Exceptions::InvalidPageValue

Inherits:
Error
  • Object
show all
Defined in:
lib/jsonapi/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page, value, msg = nil) ⇒ InvalidPageValue



333
334
335
336
337
# File 'lib/jsonapi/exceptions.rb', line 333

def initialize(page, value, msg = nil)
  @page = page
  @value = value
  @msg = msg.nil? ? "#{value} is not a valid value for #{page} page parameter." : msg
end

Instance Attribute Details

#pageObject

Returns the value of attribute page.



332
333
334
# File 'lib/jsonapi/exceptions.rb', line 332

def page
  @page
end

#valueObject

Returns the value of attribute value.



332
333
334
# File 'lib/jsonapi/exceptions.rb', line 332

def value
  @value
end

Instance Method Details

#errorsObject



339
340
341
342
343
344
# File 'lib/jsonapi/exceptions.rb', line 339

def errors
  [JSONAPI::Error.new(code: JSONAPI::INVALID_PAGE_VALUE,
                      status: :bad_request,
                      title: 'Invalid page value',
                      detail: @msg)]
end