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 =
[:contact, :details, :with_details, :schema, :with_schema]
NO_DETAILS =
[:no_details, :only_account]
WITH_ACCOUNT =
[:user, :account, :with_account]
NO_ACCOUNT =
[:no_account, :only_details]
INTERNAL_PERSON =
[:internal, :v0]
EXTERNAL_PERSON =
[:external, :v1]

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)


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

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

#add_details?Boolean

Returns:

  • (Boolean)


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

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

#external?Boolean

Returns:

  • (Boolean)


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

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

#internal?Boolean

Returns:

  • (Boolean)


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

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

#no_account?Boolean

Returns:

  • (Boolean)


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

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

#no_detailsObject



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

def no_details
  self.push(:no_details)
end

#no_details?Boolean

Returns:

  • (Boolean)


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

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

#reset_add_accountObject



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

def 
  self < self.mode - (WITH_ACCOUNT | NO_ACCOUNT)
end