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.1 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-3.0.0 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.25 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.24 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.23 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.22 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.21 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.20 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.19 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.18 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.17 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.16 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.15 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.14 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.13 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.12 lib/eco/api/common/people/default_parsers/login_providers_parser.rb
eco-helpers-2.7.4 lib/eco/api/common/people/default_parsers/login_providers_parser.rb