Module: Ecoportal::API::GraphQL::Concerns::PageCompat
- Included in:
- Interface::BasePage
- Defined in:
- lib/ecoportal/api/graphql/concerns/page_compat.rb
Overview
v2-compatibility accessors for page model objects. Include in Interface::BasePage so all concrete page classes inherit them. These aliases allow eco-helpers scripts to work against GraphQL page models using the same method names they used with ecoportal-api-v2.
Instance Method Summary collapse
-
#components ⇒ Object
v2 compatibility: dataFields were called "components" in APIv2.
-
#consolidate! ⇒ Object
Clears dirty tracking — call after a successful update.
-
#dirty? ⇒ Boolean
Dirty check — returns true if there are pending changes.
-
#external_id ⇒ Object
v2 called this externalId (camelCase) or external_id (snake_case).
-
#stages? ⇒ Boolean
Whether the page has any stages (PhasedPage check).
-
#template_id ⇒ Object
v2 called sourceTemplateId "template_id".
-
#validate ⇒ Object
v2 validate stub — always returns nil (no client-side validation in GraphQL path).
Instance Method Details
#components ⇒ Object
v2 compatibility: dataFields were called "components" in APIv2
21 22 23 |
# File 'lib/ecoportal/api/graphql/concerns/page_compat.rb', line 21 def components respond_to?(:dataFields) ? dataFields : [] end |
#consolidate! ⇒ Object
Clears dirty tracking — call after a successful update. Mirrors v2's ooze.consolidate! which resets the change baseline.
32 33 34 35 |
# File 'lib/ecoportal/api/graphql/concerns/page_compat.rb', line 32 def consolidate! @original_doc = doc.dup if respond_to?(:doc) self end |
#dirty? ⇒ Boolean
Dirty check — returns true if there are pending changes.
44 45 46 |
# File 'lib/ecoportal/api/graphql/concerns/page_compat.rb', line 44 def dirty? !as_update.nil? end |
#external_id ⇒ Object
v2 called this externalId (camelCase) or external_id (snake_case)
11 12 13 |
# File 'lib/ecoportal/api/graphql/concerns/page_compat.rb', line 11 def external_id externalId end |
#stages? ⇒ Boolean
Whether the page has any stages (PhasedPage check)
26 27 28 |
# File 'lib/ecoportal/api/graphql/concerns/page_compat.rb', line 26 def stages? respond_to?(:stages) && !stages.nil? && !stages.empty? end |
#template_id ⇒ Object
v2 called sourceTemplateId "template_id"
16 17 18 |
# File 'lib/ecoportal/api/graphql/concerns/page_compat.rb', line 16 def template_id sourceTemplateId end |
#validate ⇒ Object
v2 validate stub — always returns nil (no client-side validation in GraphQL path). Server-side errors are returned in the mutation payload's errors field.
39 40 41 |
# File 'lib/ecoportal/api/graphql/concerns/page_compat.rb', line 39 def validate nil end |