class Restspec::Stores::EndpointStoreDelegator
Provides methods for the {EndpointStore} object.
Public Instance Methods
get(endpoint_name)
click to toggle source
Get is just an alias for Hash#[] @return [Restspec::Endpoints::Endpoint, nil] the endpoint found.
# File lib/restspec/stores/endpoint_store.rb, line 18 def get(endpoint_name) self[endpoint_name] end
get_by_schema_name_and_role(schema_name, endpoint_name, role)
click to toggle source
Get an endpoint by the schema, name and a role.
@example
# Let's assume in the store there are 3 endpoints # called :show, in different namespaces. Restspec::EndpointStore.get_by_schema_name_and_role(:book, :show, :response) # => this will only return the one whose schema is :book and are suitable for response.
@return [Restspec::Endpoints::Endpoint, nil] the endpoint found.
# File lib/restspec/stores/endpoint_store.rb, line 32 def get_by_schema_name_and_role(schema_name, endpoint_name, role) values.find do |endpoint| endpoint.name == endpoint_name && endpoint.schema_for(role).try(:name) == schema_name end end
store(endpoint)
click to toggle source
Stores
an endpoint. It uses the {Restspec::Endpoints::Endpoint#full_name full_name} method of the endpoint to use as the key for the endpoint itself.
@param endpoint [Restspec::Endpoints::Endpoint] the endpoint to store. @return [Restspec::Endpoints::Endpoint] the endpoint inserted.
# File lib/restspec/stores/endpoint_store.rb, line 12 def store(endpoint) self[endpoint.full_name] = endpoint end