Class: Ecoportal::API::Internal::Person
Instance Attribute Summary
#doc
Instance Method Summary
collapse
Methods inherited from V1::Person
#add_details, #details, #details=, #supervisor, #supervisor=
#as_update, #initialize, passthrough, #print, #to_json
Instance Method Details
#account ⇒ Object
9
10
11
12
13
|
# File 'lib/ecoportal/api/internal/person.rb', line 9
def account
return @account if defined?(@account)
return @account = nil if doc["account"].nil?
@account = Internal::Account.new(doc["account"])
end
|
#account=(value) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/ecoportal/api/internal/person.rb', line 15
def account=(value)
case value
when NilClass
doc["account"] = nil
when Internal::Account
doc["account"] = JSON.parse(value.to_json)
when Hash
doc["account"] = value.slice(%w[policy_group_ids landing_page_id permissions_preset permissions_custom preferences prefilter filter_tags login_provider_ids starred_ids])
else
raise "Invalid set on account: Need nil, Account or Hash; got #{value.class}"
end
remove_instance_variable("@account") if defined?(@account)
return account
end
|
#add_account ⇒ Object
32
33
34
|
# File 'lib/ecoportal/api/internal/person.rb', line 32
def add_account
self.account = {}
end
|
#as_json ⇒ Object
5
6
7
|
# File 'lib/ecoportal/api/internal/person.rb', line 5
def as_json
super.update("account" => account&.as_json)
end
|