Module: Ecoportal::API::Common::GraphQL::Model::AsInput
- Included in:
- Ecoportal::API::Common::GraphQL::Model
- Defined in:
- lib/ecoportal/api/common/graphql/model/as_input.rb
Overview
TODO:
#as_inputvs#to_inputor named argumentklassOne gets theinputto be already used in a mutation query. The other gets theInputclass object out of theBase/Model.- To figure out when
as_updateshould be called.
- To figure out when
- Each Base/Model should have its
Inputclass counterpart. This could be auto-inflected (via namespace constant lookup) at some point. - Think if a service class can be used to this purpose (i.e. decorator of DiffService).
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#as_input(target_class: nil, clientMutationId: '') ⇒ Object
INSTANCE METHODS.
Instance Method Details
#as_input(target_class: nil, clientMutationId: '') ⇒ Object
INSTANCE METHODS
40 41 42 43 44 45 46 47 48 |
# File 'lib/ecoportal/api/common/graphql/model/as_input.rb', line 40 def as_input(target_class: nil, clientMutationId: '') return target_class.from_model(self, client_mutation_id: clientMutationId) if target_class diff = as_update return nil if diff.nil? diff[:patchVer] = patchVer if respond_to?(:patchVer) && !patchVer.nil? self.class.as_input(diff, clientMutationId: clientMutationId) end |