Sha256: 2cce29f3514bbc9d307f8bba6dd98e2e8f80ea6d60d9c6b90db66f88baf54954
Contents?: true
Size: 1.62 KB
Versions: 5
Compression:
Stored size: 1.62 KB
Contents
module Ecoportal module API class Internal class Account < Common::BaseModel passthrough :policy_group_ids, :landing_page_id, :permissions_preset, :permissions_custom, :preferences, :prefilter, :login_provider_ids, :starred_ids, :accept_eula, :send_invites, :default_tag class_resolver :preferences_class, "Ecoportal::API::Internal::Preferences" class_resolver :permissions_class, "Ecoportal::API::Internal::Permissions" embeds_one :permissions, key: "permissions_custom", klass: :permissions_class embeds_one :preferences, klass: :preferences_class # Sets the `permissions_preset`. # @note basically the same as `permissions_preset=` but when `"custom"`, it's changed to `nil` # @param value [nil, String] preset name. def preset=(value) self.permissions_preset = value == "custom" ? nil : value end # Gets the `permissions_preset`. # @note basically the same as `permissions_preset` but when 'nil', it returns `"custom"` instead # @return [nil, String] preset name. def preset self.permissions_preset.nil? ? "custom" : self.permissions_preset end def as_json super.tap do |hash| if preset == "custom" hash["permissions_custom"] = permissions.as_json else hash.delete "permissions_custom" end hash["preferences"] = preferences.as_json end end end end end end require 'ecoportal/api/internal/permissions' require 'ecoportal/api/internal/preferences'
Version data entries
5 entries across 5 versions & 1 rubygems