Sha256: 6a02b12a666e181b3ba1eedc4f0ac8db25a80c8767d39030c6b704a9e31e3d08
Contents?: true
Size: 1.16 KB
Versions: 4
Compression:
Stored size: 1.16 KB
Contents
module Eco::API::UseCases::GraphQL::Helpers::Location::Command class Result attr_reader :input, :result def initialize(input, result) @input = input @result = result end def command input.keys.first end def command_input_data input[command] end def node_id command_input_data[:nodeId] end def pending? !result || !success? end def applied? !pending? end def success? result&.ok end def error result&.error end def error? !!error end def error_msg return nil unless error? msg = '' msg << "(#{command} '#{node_id}') #{error.message}\n" return msg if error.validationErrors.empty? msg << " • " msg << error.validationErrors.map(&:message).join("\n • ") msg end def command_result result&.command end def command_id return nil unless result command_result["id"] end def as_json { "request" => input, "response" => result.doc } end end end
Version data entries
4 entries across 4 versions & 1 rubygems