class GoodData::Model::SchemaBlueprint
Attributes
Public Class Methods
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 12 def initialize(dim, blueprint) @data = dim @project_blueprint = blueprint end
Public Instance Methods
Compares two blueprints. This is done by comapring the hash represenatation. It has to be exacty identical including the order of the columns
@param name [GoodData::Model::DatasetBlueprint] Name of a field @return [Boolean] matching fields
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 158 def ==(other) to_hash == other.to_hash end
Returns anchor
@return [GoodData::Model::AnchorBlueprintField] anchor on schema
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 27 def anchor nil end
Returns true if anchor is present. Currently returns always true. Probably good to remove
@return [Boolean] is anchor on schema?l70
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 20 def anchor? true end
Returns list of all attributes defined on the schema.
@return [Array<GoodData::Model::AttributeBlueprintField>] attributes on schema
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 55 def attributes(_id = :all, _options = {}) [] end
Returns list of attributes and anchor.
@return [Array<GoodData::Model::AnchorBlueprintField | GoodData::Model::AttributeBlueprintField
>]
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 76 def attributes_and_anchors [] end
Returns list of attributes that are broken by attributes in this dataset. This means all anchors and attributes from this dataset and the ones that are referenced by any dataset. It works transitively. Includes only anchors that have labels.
@return [Array<GoodData::Model::AnchorBlueprintField | GoodData::Model::AttributeBlueprintField
>]
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 96 def breaks attrs = attributes_and_anchors.reject { |a| a.labels.empty? } referenced_by.empty? ? attrs : attrs + referenced_by.flat_map(&:breaks) end
Returns list of all bridges defined on the schema.
@return [Array<GoodData::Model::BridgeBlueprintField>] refs on schema
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 41 def bridges [] end
Returns list of attributes that can break facts in a given dataset. This basically means that it is giving you all attributes from this dataset and datasets that are referenced by given dataset transitively. Includes only anchors that have labels.
@return [Array<GoodData::Model::BlueprintField>]
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 86 def broken_by attrs = attributes_and_anchors.reject { |a| a.labels.empty? } attrs + references.map(&:dataset).flat_map(&:broken_by) end
Returns list of all facts defined on the schema.
@return [Array<GoodData::Model::FactBlueprintField>] facts on schema
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 48 def facts(_id = :all, _options = {}) [] end
Returns list of all fields defined on the schema.
@return [Array<GoodData::Model::BlueprintField>] all fields on schema
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 69 def fields [] end
Relays request on finding a dataset in the associated project blueprint. Used by reference fields
@param dataset [String] Name of a dataset @param options [Hash] additional options. See ProjectBlueprint
form more @return [GoodData::Model::DatasetBlueprint] returns matching dataset or throws an error
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 106 def find_dataset(dataset, options = {}) project_blueprint.find_dataset(dataset, options) end
Returns id of the schema
@return [String] returns id
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 113 def id data[:id] end
Returns list of all labels defined on the schema.
@return [Array<GoodData::Model::LabelBlueprintField>] labels on schema
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 62 def labels(_id = :all, _options = {}) [] end
Returns dataset that are referencing this dataset (directly through references not transitively).
@return [Array<GoodData::Model::SchemaBlueprint>] returns id
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 120 def referenced_by @project_blueprint.referencing(self) end
Returns list of all references defined on the schema.
@return [Array<GoodData::Model::ReferenceBlueprintField>] refs on schema
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 34 def references [] end
Returns dataset that are referenced by this dataset (directly through references not transitively).
@return [Array<GoodData::Model::SchemaBlueprint>] returns id
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 127 def referencing references.map(&:dataset) end
Returns title of the dataset. If it is not set up. It is generated for you based on the name which is titleized
@return [String]
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 135 def title data[:title] || GoodData::Helpers.titleize(data[:id]) end
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 162 def to_hash @data end
Validates the blueprint and returns true if model is valid. False otherwise.
@return [Boolean] is model valid?
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 142 def valid? validate.empty? end
Validates the blueprint and returns array of errors.
@return [Array<Hash>] returns array of errors or empty array
# File lib/gooddata/models/blueprint/schema_blueprint.rb, line 149 def validate fields.flat_map(&:validate) end