Sha256: 02ae9e4cb03b015e3e32cc62e54c0354bc6c6a90717b431b42700d948aae1bca

Contents?: true

Size: 843 Bytes

Versions: 37

Compression:

Stored size: 843 Bytes

Contents

class Eco::API::Common::People::DefaultParsers::LoginProvidersParser < Eco::API::Common::Loaders::Parser
  attribute "login_provider_ids"
  parsing_phase     :final
  serializing_phase :final

  def parser(hash, _deps)
    hash["login_provider_ids"].map do |name|
      login_providers.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

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

  private

  def unknown_pgs
    @unknown_pgs ||= []
  end

  def login_providers
    @login_providers ||= config.login_providers
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
eco-helpers-3.0.21 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.20 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.19 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.18 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.17 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.16 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.15 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.14 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.13 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.12 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.11 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.10 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.9 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.8 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.7 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.6 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.5 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.4 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.3 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.2 lib/eco/api/common/people/default_parsers/login_providers_parser.rb