Sha256: b792aaf39377a95ab453a0018ba62953caaac4c94ba4b199a0ea37f82da356ef
Contents?: true
Size: 798 Bytes
Versions: 1
Compression:
Stored size: 798 Bytes
Contents
require 'active_support/concern' module Restspec module Endpoints module HasSchemas extend ActiveSupport::Concern DEFAULT_ROLES = [:response] ROLES = [:response, :payload] def schema_roles @schema_roles ||= {} end def add_schema(schema_name, options) roles = options.delete(:for) || DEFAULT_ROLES roles.each do |role| schema_roles[role] = Restspec::SchemaStore.fetch(schema_name).clone if options.any? schema_roles[role].extend_with(options) end end end def all_schemas schema_roles.values end def remove_schemas schema_roles.clear end def schema_for(role_name) schema_roles[role_name] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
restspec-0.1 | lib/restspec/endpoints/has_schemas.rb |