class GoodData::Model::BlueprintField

Attributes

data[R]
dataset_blueprint[R]

Public Class Methods

new(data, dataset) click to toggle source
# File lib/gooddata/models/blueprint/blueprint_field.rb, line 16
def initialize(data, dataset)
  @data = GoodData::Helpers.symbolize_keys(data)
  @data[:type] = @data[:type].to_sym
  @dataset_blueprint = dataset
end

Public Instance Methods

==(other) click to toggle source
# File lib/gooddata/models/blueprint/blueprint_field.rb, line 56
def ==(other)
  return false unless other.respond_to?(:data)
  @data == other.data
end
id() click to toggle source
# File lib/gooddata/models/blueprint/blueprint_field.rb, line 12
def id
  @data[:id]
end
in_project(project) click to toggle source

Returns the md object in associated project or throws error if not present

@return [GoodData::MdObject] md object that is represented in the blueprint

# File lib/gooddata/models/blueprint/blueprint_field.rb, line 25
def in_project(project)
  GoodData::MdObject[id, project: project, client: project.client]
end
method_missing(method_sym, *arguments, &block) click to toggle source
Calls superclass method
# File lib/gooddata/models/blueprint/blueprint_field.rb, line 29
def method_missing(method_sym, *arguments, &block)
  if @data.key?(method_sym)
    @data[method_sym]
  else
    super
  end
end
respond_to_missing?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/gooddata/models/blueprint/blueprint_field.rb, line 37
def respond_to_missing?(method_name, include_private = false)
  if @data.key?(method_name)
    true
  else
    super
  end
end
title() click to toggle source
# File lib/gooddata/models/blueprint/blueprint_field.rb, line 45
def title
  @data[:title] || GoodData::Helpers.titleize(@data[:id])
end
validate() click to toggle source

Validates the fields in the field

@return [Array] returns list of the errors represented by hash structures

# File lib/gooddata/models/blueprint/blueprint_field.rb, line 52
def validate
  []
end

Private Instance Methods

validate_presence_of(*fields) click to toggle source
# File lib/gooddata/models/blueprint/blueprint_field.rb, line 63
def validate_presence_of(*fields)
  fields.reduce([]) do |a, e|
    data.key?(e) && !data[e].blank? ? a : a + [e]
  end
end