class GoodData::Model::SchemaBuilder
Attributes
Public Class Methods
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 19 def create(id, options = {}, &block) pb = SchemaBuilder.new(id, options) block.call(pb) pb end
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 13 def create_from_data(blueprint) sc = SchemaBuilder.new sc.data = blueprint.to_hash sc end
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 26 def initialize(id = nil, options = {}) @data = { id: id, type: :dataset, columns: [] }.merge(options) end
Public Instance Methods
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 47 def add_anchor(id, options = {}) add_column({ type: :anchor, id: id }.merge(options)) self end
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 52 def add_attribute(id, options = {}) add_column({ type: :attribute, id: id }.merge(options)) self end
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 42 def add_column(column_def) columns.push(column_def) self end
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 68 def add_date(dataset_id, options = {}) add_column({ type: :date, dataset: dataset_id, format: GoodData::Model::DEFAULT_DATE_FORMAT }.merge(options)) end
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 57 def add_fact(id, options = {}) data = { type: :fact, id: id }.merge(options) add_column(data) self end
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 63 def add_label(id, options = {}) add_column({ type: :label, id: id }.merge(options)) self end
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 72 def add_reference(dataset, options = {}) add_column({ type: :reference, dataset: dataset }.merge(options)) end
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 38 def columns data[:columns] end
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 34 def name data[:name] end
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 84 def to_blueprint GoodData::Model::ProjectBlueprint.new(datasets: [to_hash]) end
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 80 def to_hash data end
Source
# File lib/gooddata/models/blueprint/schema_builder.rb, line 76 def to_json JSON.pretty_generate(to_hash) end