Sha256: 7c0f18ed2477ffe4c531dd468a6c083a90fa7ccdd93ac2e3a96c51f66bf40b63

Contents?: true

Size: 1.19 KB

Versions: 33

Compression:

Stored size: 1.19 KB

Contents

module Ecoportal
  module API
    class GraphQL
      module Base
        class Model < Ecoportal::API::Common::Content::DoubleModel
          include Ecoportal::API::Common::GraphQL::ClassHelpers
          #include GraphModel::HashKeys
          class << self
            attr_accessor :client
            
            def as_input(hash, clientMutationId: "")
              hash_input = hash.merge(clientMutationId: clientMutationId)
              Ecoportal::API::Common::GraphQL::HashHelpers.remove_nil_keys_deep(hash_input, target: :id)
            end
          end

          def as_update(ref = :last, ignore: [], sym_keys: false)
            new_doc = as_json
            ref_doc = ref == :total ? initial_doc : original_doc
            Ecoportal::API::Common::HashDiff.diff(new_doc, ref_doc, ignore: ignore).yield_self do |out|
              next out unless sym_keys
              Ecoportal::API::Common::GraphQL::HashHelpers.keys_to_sym_deep(out)
            end
          end

          def as_input(clientMutationId: "")
            self.class.as_input(as_update(sym_keys: true), clientMutationId: clientMutationId)
          end
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
ecoportal-api-graphql-0.2.1 lib/ecoportal/api/graphql/base/model.rb
ecoportal-api-graphql-0.1.11 lib/ecoportal/api/graphql/base/model.rb
ecoportal-api-graphql-0.1.10 lib/ecoportal/api/graphql/base/model.rb
ecoportal-api-graphql-0.1.9 lib/ecoportal/api/graphql/base/model.rb
ecoportal-api-graphql-0.1.8 lib/ecoportal/api/graphql/base/model.rb
ecoportal-api-graphql-0.1.7 lib/ecoportal/api/graphql/base/model.rb
ecoportal-api-graphql-0.1.6 lib/ecoportal/api/graphql/base/model.rb
ecoportal-api-graphql-0.1.5 lib/ecoportal/api/graphql/base/model.rb
ecoportal-api-graphql-0.1.4 lib/ecoportal/api/graphql/base/model.rb
ecoportal-api-graphql-0.1.3 lib/ecoportal/api/graphql/base/model.rb
ecoportal-api-graphql-0.1.2 lib/ecoportal/api/graphql/base/model.rb
ecoportal-api-graphql-0.1.1 lib/ecoportal/api/graphql/base/model.rb
ecoportal-api-graphql-0.1.0 lib/ecoportal/api/graphql/base/model.rb