Exception: Graphiti::Errors::InvalidEndpoint

Inherits:
Base
  • Object
show all
Defined in:
lib/graphiti/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(resource_class, path, action) ⇒ InvalidEndpoint

Returns a new instance of InvalidEndpoint.



449
450
451
452
453
# File 'lib/graphiti/errors.rb', line 449

def initialize(resource_class, path, action)
  @resource_class = resource_class
  @path = path
  @action = action
end

Instance Method Details

#messageObject



455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
# File 'lib/graphiti/errors.rb', line 455

def message
  <<-MSG
    #{@resource_class.name} cannot be called directly from endpoint #{@path}##{@action}!

    Either set a primary endpoint for this resource:

    primary_endpoint '/my/url', [:index, :show, :create]

    Or whitelist a secondary endpoint:

    secondary_endpoint '/my_url', [:index, :update]

    Or disable endpoint validation for this resource:

    self.validate_endpoints = false

    See https://www.graphiti.dev/guides/concepts/links for more information.

    The current endpoints allowed for this resource are: #{@resource_class.endpoints.inspect}
  MSG
end