Module: Sequencescape::Api::Associations::InstanceMethods

Included in:
Base
Defined in:
lib/sequencescape-api/associations.rb

Defined Under Namespace

Classes: CompositeErrors

Instance Method Summary (collapse)

Instance Method Details

- (Object) attributes_for(path, default_value_if_missing = nil)



51
52
53
54
# File 'lib/sequencescape-api/associations.rb', line 51

def attributes_for(path, default_value_if_missing = nil)
  attributes_from_path(path, default_value_if_missing) or
    raise Sequencescape::Api::JsonError.new(path.to_s, self)
end

- (Boolean) attributes_for?(path)



56
57
58
# File 'lib/sequencescape-api/associations.rb', line 56

def attributes_for?(path)
  !!attributes_from_path(path)
end

- (Object) errors



98
99
100
# File 'lib/sequencescape-api/associations.rb', line 98

def errors
  @errors ||= CompositeErrors.new(self)
end

- (InstanceMethods) initialize(*args, &block)



43
44
45
46
# File 'lib/sequencescape-api/associations.rb', line 43

def initialize(*args, &block)
  @associations, @errors = {}, nil
  super
end

- (Object) run_validations!



65
66
67
68
# File 'lib/sequencescape-api/associations.rb', line 65

def run_validations!
  our_result, their_result = super, @associations.values.all?(&:run_validations!)
  our_result and their_result
end