Class: Ecoportal::API::Internal::Person
- Inherits:
-
V1::Person
- Object
- Common::BaseModel
- V1::Person
- Ecoportal::API::Internal::Person
- Defined in:
- lib/ecoportal/api/internal/person.rb
Instance Attribute Summary
Attributes inherited from Common::BaseModel
Instance Method Summary collapse
Methods inherited from V1::Person
#details, #details=, #supervisor, #supervisor=
Methods inherited from Common::BaseModel
#as_update, #initialize, passthrough, #print
Constructor Details
This class inherits a constructor from Ecoportal::API::Common::BaseModel
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 # TODO 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 # TODO raise "Invalid set on account: Need nil, Account or Hash; got #{value.class}" end remove_instance_variable("@account") return 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 |