Class: PuzzlyApiPlugin::Query
- Defined in:
- lib/puzzly_api_plugin/metadata/query.rb
Class Method Summary collapse
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(document, module_id, name, description, schema_file) ⇒ Query
constructor
A new instance of Query.
- #module_id ⇒ Object
- #schema_file ⇒ Object
- #validate ⇒ Object
Methods inherited from Metadata
#id, #name, #path, #to_identity
Methods inherited from JSONable
Constructor Details
#initialize(document, module_id, name, description, schema_file) ⇒ Query
Returns a new instance of Query.
13 14 15 16 17 18 19 20 |
# File 'lib/puzzly_api_plugin/metadata/query.rb', line 13 def initialize(document, module_id, name, description, schema_file) super(document, name) self[MetadataFields::MODULE_ID] = module_id self[MetadataFields::DESCRIPTION] = description self[MetadataFields::SCHEMA_FILE] = schema_file validate end |
Class Method Details
.create(document) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/puzzly_api_plugin/metadata/query.rb', line 5 def self.create(document) Query.new(document, document.data[YAMLFields::MODULE_ID], document.data[YAMLFields::QUERY_NAME], document.data[YAMLFields::QUERY_DESCRIPTION], document.data[YAMLFields::QUERY_SCHEMA_FILE]) end |
Instance Method Details
#description ⇒ Object
44 45 46 |
# File 'lib/puzzly_api_plugin/metadata/query.rb', line 44 def description self[MetadataFields::DESCRIPTION] end |
#module_id ⇒ Object
40 41 42 |
# File 'lib/puzzly_api_plugin/metadata/query.rb', line 40 def module_id self[MetadataFields::MODULE_ID] end |
#schema_file ⇒ Object
48 49 50 |
# File 'lib/puzzly_api_plugin/metadata/query.rb', line 48 def schema_file self[MetadataFields::SCHEMA_FILE] end |
#validate ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/puzzly_api_plugin/metadata/query.rb', line 22 def validate if(module_id.nil?) warn "Please set #{YAMLFields::MODULE_ID} property" end if(name.nil?) warn "Please set #{YAMLFields::QUERY_NAME} property" end if(description.nil?) warn "Please set #{YAMLFields::QUERY_DESCRIPTION} property" end if(schema_file.nil?) warn "Please set #{YAMLFields::QUERY_SCHEMA_FILE} property" end end |