Class: Eco::API::Common::People::DefaultParsers::LoginProvidersParser

Inherits:
Loaders::Parser show all
Defined in:
lib/eco/api/common/people/default_parsers/login_providers_parser.rb

Instance Attribute Summary

Attributes included from Language::AuxiliarLogger

#logger

Instance Method Summary collapse

Methods inherited from Loaders::Parser

active_when_all, active_when_any, #attribute, attribute, dependencies, #initialize, parsing_phase, serializing_phase

Methods inherited from Loaders::CaseBase

#name, name_only_once!

Methods inherited from Loaders::Base

<=>, created_at, #initialize, set_created_at!

Methods included from ClassHelpers

#class_resolver, #descendants, #descendants?, #inheritable_attrs, #inheritable_class_vars, #inherited, #instance_variable_name, #new_class, #resolve_class, #to_constant

Methods included from Language::AuxiliarLogger

#log

Constructor Details

This class inherits a constructor from Eco::API::Common::Loaders::Parser

Instance Method Details

#parser(hash, _deps) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/eco/api/common/people/default_parsers/login_providers_parser.rb', line 6

def parser(hash, _deps)
  hash["login_provider_ids"].map do |name|
    .to_id(name&.downcase&.strip).tap do |known|
      unless !name || known || unknown_pgs.include?(name)
        unknown_pgs.push(name)
        log(:warn) { "Unknown Login Provider: '#{name}'" }
      end
    end
  end.compact
end

#serializer(hash, _deps) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/eco/api/common/people/default_parsers/login_providers_parser.rb', line 17

def serializer(hash, _deps)
  if (ids = hash["login_provider_ids"])
    .to_name(ids)
  else
    []
  end
end