lib/eco/api/usecases/ooze_samples/helpers/creatable.rb in eco-helpers-2.6.4 vs lib/eco/api/usecases/ooze_samples/helpers/creatable.rb in eco-helpers-2.7.0
- old
+ new
@@ -11,13 +11,13 @@
def creating_new_page(draft_reference = "new entry", template_id:)
page_id = nil
drafting_entry(template_id) do |draft|
yield(draft) if block_given?
- if page_id = create_entry(draft, reference: draft_reference)
+ if (page_id = create_entry(draft, reference: draft_reference))
log(:info) { "Page '#{page_id}' created successfully -- #{draft_reference}" }
- elsif options.dig(:dry_run)
+ elsif options[:dry_run]
log(:info) { "Simulated launch for #{draft_reference}" }
end
end
page_id
end
@@ -30,11 +30,11 @@
end
# Does the actual creation of the entry
def create_entry(draft, reference: "new entry from #{draft&.template_id}")
with_rescue(reference) do
- if result = create_ooze(draft, template_id: draft.template_id)
+ if (result = create_ooze(draft, template_id: draft.template_id))
return result.page_id
end
end
end
end
@@ -46,9 +46,10 @@
base.include(InstanceMethods)
end
def validate_base_type!(base)
return super if defined?(super)
+
msg = "#{self} can only be included in Eco::API::UseCases::OozeSamples::RegisterUpdateCase"
msg << "\nCan't be included in #{base}"
raise LoadError, msg unless base <= Eco::API::UseCases::OozeSamples::RegisterUpdateCase
true
end