class Eco::API::UseCases::OozeSamples::OozeUpdateCase

Private Instance Methods

add_field(name, type, section, after: nil, side: :left) { |field| ... } click to toggle source
# File lib/eco/api/usecases/ooze_samples/ooze_update_case.rb, line 36
def add_field(name, type, section, after:  nil, side: :left)
  raise "You need to specify a section for a new field. Given: #{section.class}" unless section.is_a?(Ecoportal::API::V2::Page::Section)
  target.components.add(label: name, type: type) do |field|
    section.add_component(field, after: after, side: side)
  end.tap do |field|
    yield(field) if block_given?
  end
end
to_field(value) click to toggle source
# File lib/eco/api/usecases/ooze_samples/ooze_update_case.rb, line 45
def to_field(value)
  fld   = nil
  fld ||= value if value.is_a?(Ecoportal::API::V2::Page::Component)
  fld ||= target.components.get_by_id(value)
  fld ||= target.components.select {|fld| same_name?(fld.label, value)}
  #fld ||= value.reference if value.is_a?(Ecoportal::API::V2::Page::Force::Binding)
end
with_fields(type: nil, label: nil) { |field| ... } click to toggle source
# File lib/eco/api/usecases/ooze_samples/ooze_update_case.rb, line 7
def with_fields(type: nil, label: nil)
  flds = target.components
  flds = flds.get_by_type(type) if type
  flds = flds.select do |fld|
    value = (label == :unnamed) ? nil : label
    !label || same_string?(fld.label, value)
  end.each do |field|
    yield(field) if block_given?
  end
end
with_sections(type: nil, heading: nil) { |sec| ... } click to toggle source
# File lib/eco/api/usecases/ooze_samples/ooze_update_case.rb, line 18
def with_sections(type: nil, heading: nil)
  secs = target.sections
  secs = secs.get_by_type(type) if type
  secs = secs.select do |sec|
    value = (heading == :unnamed) ? nil : heading
    !heading || same_string?(sec.heading, value)
  end.each do |sec|
    yield(sec) if block_given?
  end
end
with_stage(name:) { |stage| ... } click to toggle source
# File lib/eco/api/usecases/ooze_samples/ooze_update_case.rb, line 29
def with_stage(name:)
  if stage = target.stages.get_by_name(name)
    yield(stage) if block_given?
  end
  stage
end