Class: PuzzlyApiPlugin::SchemasCollection

Inherits:
Collection show all
Includes:
Singleton
Defined in:
lib/puzzly_api_plugin/collection/schemas.rb

Instance Method Summary collapse

Methods inherited from Collection

#add_metadata, #get_by_id, #identities

Methods inherited from JSONable

#copy_to_hash, #to_s

Instance Method Details

#add(document) ⇒ Object



7
8
9
10
# File 'lib/puzzly_api_plugin/collection/schemas.rb', line 7

def add(document)
  schema = Schema.create(document)
   schema
end

#get_by_context(context) ⇒ Object



12
13
14
# File 'lib/puzzly_api_plugin/collection/schemas.rb', line 12

def get_by_context(context)
  select { |_id, schema| schema.context_id == context.id }
end