Sha256: 6a0df98488125be406ad3ba182f4fa1f4f2f2dea3a9d8c2060476c28c27bb421
Contents?: true
Size: 893 Bytes
Versions: 2
Compression:
Stored size: 893 Bytes
Contents
module Ecoportal module API class V2 class Page < Common::BaseModel passthrough :id, :name, :state class_resolver :stage_class, "Ecoportal::API::V2::Stage" class_resolver :field_class, "Ecoportal::API::V2::Field" def stages return nil unless doc["evolution"] return @stages if defined?(@stages) @stages = (doc["evolution"]["stages"] || []).each_with_index.map do |stage, i| stage_class.new(stage, parent: self, key: ["stages", i]) end end def fields return @fields if defined?(@fields) @fields = (doc["components"] || []).each_with_index.map do |component, i| field_class.new(component, parent: self, key: ["components", i]) end end end end end end require 'ecoportal/api/v2/stage' require 'ecoportal/api/v2/field'
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ecoportal-api-0.7.5 | lib/ecoportal/api/v2/page.rb |
ecoportal-api-0.7.4 | lib/ecoportal/api/v2/page.rb |