Sha256: b84d4b28786124f25e228cbc7c5887bbbc3262e2f307a4549136bec03ed0fe5c

Contents?: true

Size: 996 Bytes

Versions: 5

Compression:

Stored size: 996 Bytes

Contents

module Ecoportal
  module API
    class Internal
      class Person

        def reset_account!
          doc["account"] = JSON.parse(original_doc["account"])
        end

        def consolidate_account!
          original_doc["account"] = JSON.parse(doc["account"])
        end

        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 default_tag 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") if defined?(@account)
          return account
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
eco-helpers-1.0.5 lib/eco/api/common/version_patches/ecoportal_api/internal_person.rb
eco-helpers-1.0.4 lib/eco/api/common/version_patches/ecoportal_api/internal_person.rb
eco-helpers-1.0.3 lib/eco/api/common/version_patches/ecoportal_api/internal_person.rb
eco-helpers-0.9.5 lib/eco/api/common/version_patches/ecoportal_api/internal_person.rb
eco-helpers-1.0.2 lib/eco/api/common/version_patches/ecoportal_api/internal_person.rb