Sha256: 2a87b7451161e59e39ab72e9b93d7ca3d82ec406609cb9b1ee5ed646daf83488

Contents?: true

Size: 1.67 KB

Versions: 15

Compression:

Stored size: 1.67 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
        with_error_handling do
          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
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
eco-helpers-3.0.21 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.20 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.19 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.18 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.17 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.16 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.15 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.14 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.13 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.12 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.11 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.10 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.9 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.8 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb
eco-helpers-3.0.7 lib/eco/api/usecases/graphql/samples/location/service/tree_to_list.rb