Sha256: bf4678545e799bc1532746233cf432d3ee7acd63bd0c0be6c5e088e2c824f681

Contents?: true

Size: 1.62 KB

Versions: 22

Compression:

Stored size: 1.62 KB

Contents

module Eco::API::UseCases::GraphQL::Samples
  module Location::Service
    # Service to transform (CONVERT or PARSE) an input locations structure into a list
    # of hash nodes.
    # @note it can have multiple usages
    #   1. Live locations tree structure into a nodes list file (nodeId, parendId, name,...)
    #   2. A locations tree built from an input csv into a nodes list hash
    #   3. Change the keys of the hash nodes
    #   4. Parse the values
    # @note this use case can be inherited from to provision **parsed** input to other
    #   use cases.
    # @note it allows to define `custom_node_parser` and `custom_node_parser_after`
    #   methods (param: `node_hash`), to allow custom parsing.
    #   - It has a generic parser that validates the `classifications`
    # As this format allows to easily compare what has changed in the locations structure.
    # @example
    #     class Custom::UseCase::TagtreeToList < Eco::API::UseCases::GraphQL::Samples::Location
    #       name 'tagtree-to-list'
    #       type :other
    #
    #       include Eco::API::UseCases::GraphQL::Samples::Location::Service::TreeToList
    #
    #     end
    module TreeToList
      include Eco::API::UseCases::GraphQL::Samples::Location::DSL

      require_relative 'tree_to_list/output'
      require_relative 'tree_to_list/converter'

      include Output
      include Converter

      def process
        as_nodes_json(input_tagtree).tap do |list|
          next generate_live_nodes_file(list) unless list.empty?

          log(:error) { "There are no location nodes!" }
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
eco-helpers-3.0.6 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.5 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.4 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.3 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.2 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.1 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.0 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-2.7.25 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-2.7.24 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-2.7.23 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-2.7.22 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-2.7.21 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-2.7.20 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-2.7.19 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-2.7.18 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-2.7.17 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-2.7.16 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-2.7.15 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-2.7.14 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-2.7.13 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb