Class: Ecoportal::API::Internal::Account
- Inherits:
-
Common::BaseModel
- Object
- Common::BaseModel
- Ecoportal::API::Internal::Account
- Defined in:
- lib/ecoportal/api/internal/account.rb
Constant Summary collapse
- PROPERTIES =
[ "user_id", "policy_group_ids", "default_tag", "prefilter", "permissions_custom", "permissions_merged", "preferences", "login_provider_ids", "starred_ids", "landing_page_id", "accept_eula", "send_invites", "force_send_invites" ]
Instance Attribute Summary
Attributes inherited from Common::BaseModel
Instance Method Summary collapse
- #as_json ⇒ Object
- #as_update(ref = :last, ignore: []) ⇒ Object
-
#default_tag=(value) ⇒ String?
Sets the
default_tag
of the user. -
#login_provider_ids ⇒ Array<String>
The login provider ids of this user.
-
#login_provider_ids=(value) ⇒ Object
Sets the
login_provider_ids
. -
#permissions_custom=(value) ⇒ Object
It preserves the values of keys that are not defined in
value
. -
#policy_group_ids ⇒ Array<String>
The policy group ids of this user.
-
#policy_group_ids=(value) ⇒ Object
Sets the
policy_group_ids
. -
#preferences=(value) ⇒ Object
It preserves the values of keys that are not defined in
value
. -
#starred_ids ⇒ Array<String>
The starred page ids of this user.
-
#starred_ids=(value) ⇒ Object
Sets the
starred_ids
.
Methods inherited from Common::BaseModel
#consolidate!, #dirty?, #doc, embeds_one, #initial_doc, #initialize, #original_doc, passthrough, #print_pretty, #replace_doc!, #replace_original_doc!, #reset!, #to_json
Methods included from Common::BaseClass
#class_resolver, #redef_without_warning, #resolve_class
Constructor Details
This class inherits a constructor from Ecoportal::API::Common::BaseModel
Instance Method Details
#as_json ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/ecoportal/api/internal/account.rb', line 83 def as_json super.tap do |hash| hash["permissions_custom"] = .as_json hash["permissions_merged"] = perms_merged.as_json hash["preferences"] = preferences.as_json end end |
#as_update(ref = :last, ignore: []) ⇒ Object
91 92 93 |
# File 'lib/ecoportal/api/internal/account.rb', line 91 def as_update(ref = :last, ignore: []) super(ref, ignore: ignore | ["user_id", "permissions_merged", "prefilter"]) end |
#default_tag=(value) ⇒ String?
it upcases the value
Sets the default_tag
of the user
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ecoportal/api/internal/account.rb', line 24 def default_tag=(value) unless !value || value.is_a?(String) raise ArgumentError.new("default_tag= needs to be passed a String or nil, got #{value.class}") end if value unless value.match(Ecoportal::API::V1::Person::VALID_TAG_REGEX) raise ArgumentError.new("Invalid default tag #{value.inspect}") end value = value.upcase end doc["default_tag"] = value end |
#login_provider_ids ⇒ Array<String>
Returns the login provider ids of this user.
55 56 57 |
# File 'lib/ecoportal/api/internal/account.rb', line 55 def login_provider_ids doc["login_provider_ids"] ||= [] end |
#login_provider_ids=(value) ⇒ Object
Sets the login_provider_ids
50 51 52 |
# File 'lib/ecoportal/api/internal/account.rb', line 50 def login_provider_ids=(value) set_uniq_array_keep_order("login_provider_ids", value) end |
#permissions_custom=(value) ⇒ Object
It preserves the values of keys that are not defined in value
.
71 72 73 74 |
# File 'lib/ecoportal/api/internal/account.rb', line 71 def (value) doc["permissions_custom"] ||= {} doc["permissions_custom"].merge!(value) end |
#policy_group_ids ⇒ Array<String>
Returns the policy group ids of this user.
45 46 47 |
# File 'lib/ecoportal/api/internal/account.rb', line 45 def policy_group_ids doc["policy_group_ids"] ||= [] end |
#policy_group_ids=(value) ⇒ Object
it preserves the original order
Sets the policy_group_ids
40 41 42 |
# File 'lib/ecoportal/api/internal/account.rb', line 40 def policy_group_ids=(value) set_uniq_array_keep_order("policy_group_ids", value) end |
#preferences=(value) ⇒ Object
It preserves the values of keys that are not defined in value
.
78 79 80 81 |
# File 'lib/ecoportal/api/internal/account.rb', line 78 def preferences=(value) doc["preferences"] ||= {} doc["preferences"].merge!(value) end |
#starred_ids ⇒ Array<String>
Returns the starred page ids of this user.
65 66 67 |
# File 'lib/ecoportal/api/internal/account.rb', line 65 def starred_ids doc["starred_ids"] ||= [] end |
#starred_ids=(value) ⇒ Object
Sets the starred_ids
60 61 62 |
# File 'lib/ecoportal/api/internal/account.rb', line 60 def starred_ids=(value) set_uniq_array_keep_order("starred_ids", value) end |