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

Returns a new instance of InvalidPageValue.



371
372
373
374
375
# File 'lib/jsonapi/exceptions.rb', line 371

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

Instance Attribute Details

#pageObject

Returns the value of attribute page.



370
371
372
# File 'lib/jsonapi/exceptions.rb', line 370

def page
  @page
end

#valueObject

Returns the value of attribute value.



370
371
372
# File 'lib/jsonapi/exceptions.rb', line 370

def value
  @value
end

Instance Method Details

#errorsObject



377
378
379
380
381
382
# File 'lib/jsonapi/exceptions.rb', line 377

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