Class: Groovestack::Base::GraphQL::SchemaAbstract

Inherits:
GraphQL::Schema
  • Object
show all
Defined in:
lib/groovestack/base/graphql/schema_abstract.rb

Class Method Summary collapse

Class Method Details

.id_from_object(object, _type_definition, _query_ctx) ⇒ Object

Return a string UUID for ‘object`



61
62
63
64
# File 'lib/groovestack/base/graphql/schema_abstract.rb', line 61

def self.id_from_object(object, _type_definition, _query_ctx)
  # For example, use Rails' GlobalID library (https://github.com/rails/globalid):
  object.to_gid_param
end

.object_from_id(global_id, _query_ctx) ⇒ Object

Given a string UUID, find the object



67
68
69
70
# File 'lib/groovestack/base/graphql/schema_abstract.rb', line 67

def self.object_from_id(global_id, _query_ctx)
  # For example, use Rails' GlobalID library (https://github.com/rails/globalid):
  ::GlobalID.find(global_id)
end

.resolve_type(_abstract_type, _obj, _ctx) ⇒ Object

Union and Interface Resolution

Raises:

  • (::GraphQL::RequiredImplementationMissingError)


53
54
55
56
# File 'lib/groovestack/base/graphql/schema_abstract.rb', line 53

def self.resolve_type(_abstract_type, _obj, _ctx)
  # to return the correct GraphQL object type for `obj`
  raise(::GraphQL::RequiredImplementationMissingError)
end