Sha256: 84b0c1ece42a0b9410763e7920b9f7127388b2dff93004fa31756d3112a09520

Contents?: true

Size: 821 Bytes

Versions: 2

Compression:

Stored size: 821 Bytes

Contents

module Ecoportal
  module API
    class V2
      class Pages
        class PageStage < V2::Page
          passthrough :mould_counter, :archive
          passthrough :task_priority, :state, :status
          passthrough :votes_enabled, :upvotes, :downvotes

          embeds_many :permits, klass: "Ecoportal::API::V2::Page::Permit"
          passarray   :force_errors, :subtags, order_matters: false

          # `id` of the stage we got the data of.
          def current_stage_id
            doc.dig("active_stage", "id") || doc["current_stage_id"]
          end

          # @return [Ecoportal::API::V2::Page::Stage]
          def current_stage
            if stage_id = current_stage_id
              stages[stage_id]
            end
          end

        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ecoportal-api-v2-0.8.13 lib/ecoportal/api/v2/pages/page_stage.rb
ecoportal-api-v2-0.8.12 lib/ecoportal/api/v2/pages/page_stage.rb