Class: Eco::API::Common::People::PersonModifier

Inherits:
Language::Models::Modifier show all
Defined in:
lib/eco/api/common/people/person_modifier.rb

Constant Summary collapse

WITH_DETAILS =
%i[contact details with_details schema with_schema].freeze
NO_DETAILS =
%i[no_details only_account].freeze
WITH_ACCOUNT =
%i[user account with_account].freeze
NO_ACCOUNT =
%i[no_account only_details].freeze
INTERNAL_PERSON =
%i[internal v0].freeze
EXTERNAL_PERSON =
%i[external v1].freeze

Constants inherited from Language::Models::Modifier

Language::Models::Modifier::DEFAULT_MODE

Instance Method Summary collapse

Methods inherited from Language::Models::Modifier

#<, #<<, #default, #default?, #flush_mode, #initialize, #mode, #new, #reset

Constructor Details

This class inherits a constructor from Eco::Language::Models::Modifier

Instance Method Details

#add_account?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/eco/api/common/people/person_modifier.rb', line 23

def add_account?
  mode.any? { |m| WITH_ACCOUNT.include?(m) }
end

#add_details?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/eco/api/common/people/person_modifier.rb', line 31

def add_details?
  mode.any? { |m| WITH_DETAILS.include?(m) }
end

#external?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/eco/api/common/people/person_modifier.rb', line 44

def external?
  mode.any? { |m| EXTERNAL_PERSON.include?(m) }
end

#internal?Boolean

Returns:

  • (Boolean)


39
40
41
42
# File 'lib/eco/api/common/people/person_modifier.rb', line 39

def internal?
  bool = mode.any? { |m| INTERNAL_PERSON.include?(m) }
  bool || !external?
end

#no_account?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/eco/api/common/people/person_modifier.rb', line 27

def no_account?
  mode.any? { |m| NO_ACCOUNT.include?(m) }
end

#no_detailsObject



19
20
21
# File 'lib/eco/api/common/people/person_modifier.rb', line 19

def no_details
  push(:no_details)
end

#no_details?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/eco/api/common/people/person_modifier.rb', line 35

def no_details?
  mode.any? { |m| NO_DETAILS.include?(m) }
end

#reset_add_accountObject



15
16
17
# File 'lib/eco/api/common/people/person_modifier.rb', line 15

def 
  self < mode - (WITH_ACCOUNT | NO_ACCOUNT)
end