Class: Ecoportal::API::GraphQL::Payload::LocationStructure::CommandExecutionResult

Inherits:
Logic::BaseModel show all
Includes:
Error::LocationsError::FetchNested
Defined in:
lib/ecoportal/api/graphql/payload/location_structure/command_execution_result.rb

Constant Summary

Constants included from Common::GraphQL::Model::Diffable

Common::GraphQL::Model::Diffable::DIFF_CLASS

Instance Method Summary collapse

Methods included from Error::LocationsError::FetchNested

#loc_err_conflicting_ids, #loc_err_conflicting_ids?, #locations_error?, #locations_error_doc, #validationErrors, #validationErrors?

Methods included from Common::GraphQL::Model::AsInput

#as_input

Methods included from Common::GraphQL::Model::Diffable

#as_update, #dirty?

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/ecoportal/api/graphql/payload/location_structure/command_execution_result.rb', line 24

def error?
  locations_error? ||
    !ok?
end

#error_docObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/ecoportal/api/graphql/payload/location_structure/command_execution_result.rb', line 29

def error_doc
  if locations_error?
    {
      locationsError: locations_error_doc
    }
  elsif !ok?
    {
      ok: ok
    }
  end.tap do |err_doc|
    next unless err_doc.is_a?(Hash)
    next if err_doc.empty?

    err_doc[:command] = command.doc
  end
end

#ok?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/ecoportal/api/graphql/payload/location_structure/command_execution_result.rb', line 16

def ok?
  ok != false
end

#success?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/ecoportal/api/graphql/payload/location_structure/command_execution_result.rb', line 20

def success?
  !error?
end