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.



384
385
386
387
388
# File 'lib/graphiti/errors.rb', line 384

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

Instance Method Details

#messageObject



390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/graphiti/errors.rb', line 390

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]

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