Sha256: fbf67090d714051308444e4e309f8a28fc8f32ea1575ec31ccd574681465f336

Contents?: true

Size: 1.59 KB

Versions: 84

Compression:

Stored size: 1.59 KB

Contents

module Eco
  module API
    module Common
      module People

        # Class to define a set of default attribute parsers
        class DefaultParsers < PersonParser
          autoloads_children_of "Eco::API::Common::Loaders::Parser"
          autoload_namespace    "Eco::API::Common::People::DefaultParsers"

          def initialize(*args)
            super(*args)
            define_defaults
          end

          private

          def define_defaults
            # Select Options
            select_hashes = @schema.fields.map do |fld|
              if fld.type == "select"
                raise "The schema selection field '#{fld.name}' is missing selection options." unless fld.options && !fld.options.empty?
                options_hash = fld.options.map { |v| [v.downcase.strip, v] }.to_h
                [fld.alt_id, options_hash]
              end
            end.compact.to_h

            SelectParser.new(self, select_hashes: select_hashes).process
          end

        end
      end
    end
  end
end

require_relative 'default_parsers/select_parser'
require_relative 'default_parsers/boolean_parser'
require_relative 'default_parsers/numeric_parser'
require_relative 'default_parsers/date_parser'
require_relative 'default_parsers/multi_parser'
require_relative 'default_parsers/send_invites_parser'
require_relative 'default_parsers/freemium_parser'
require_relative 'default_parsers/policy_groups_parser'
require_relative 'default_parsers/login_providers_parser'
require_relative 'default_parsers/csv_parser'
require_relative 'default_parsers/xls_parser'

Version data entries

84 entries across 84 versions & 1 rubygems

Version Path
eco-helpers-2.0.65 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.64 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.63 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.62 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.61 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.60 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.59 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.58 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.57 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.56 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.55 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.54 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.53 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.52 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.51 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.50 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.49 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.48 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.47 lib/eco/api/common/people/default_parsers.rb
eco-helpers-2.0.46 lib/eco/api/common/people/default_parsers.rb