Class: Ecoportal::API::GraphQL::Compat::PageReference

Inherits:
Object
  • Object
show all
Defined in:
lib/ecoportal/api/graphql/compat/page_reference.rb

Overview

Returned by Compat::Pages#create — mirrors the v2 reference object. Scripts access .page_id and .active_stage_id after page creation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page) ⇒ PageReference

Returns a new instance of PageReference.



10
11
12
13
14
# File 'lib/ecoportal/api/graphql/compat/page_reference.rb', line 10

def initialize(page)
  @page            = page
  @page_id         = page.id
  @active_stage_id = page.respond_to?(:current_stage_id) ? page.current_stage_id : nil
end

Instance Attribute Details

#active_stage_idObject (readonly)

Returns the value of attribute active_stage_id.



8
9
10
# File 'lib/ecoportal/api/graphql/compat/page_reference.rb', line 8

def active_stage_id
  @active_stage_id
end

#pageObject (readonly)

Returns the value of attribute page.



8
9
10
# File 'lib/ecoportal/api/graphql/compat/page_reference.rb', line 8

def page
  @page
end

#page_idObject (readonly)

Returns the value of attribute page_id.



8
9
10
# File 'lib/ecoportal/api/graphql/compat/page_reference.rb', line 8

def page_id
  @page_id
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/ecoportal/api/graphql/compat/page_reference.rb', line 16

def success?
  !@page_id.nil?
end